haskell.nix icon indicating copy to clipboard operation
haskell.nix copied to clipboard

`nix flake check` fails

Open tscholak opened this issue 3 years ago • 3 comments

Hi, With a very basic flake modelled after the example in the Haskell.nix documentation, nix flake check fails with:

error: a 'i686-linux' with features {} is required to build '/nix/store/8igy03q4v1y9d79y4l1zhs045pcfb0i1-bootstrap-stage0-stdenv-linux.drv', but I am a 'x86_64-darwin' with features {benchmark, big-parallel, nixos-test}

This seems to be the same error as in https://github.com/NixOS/nix/issues/4265.

What workarounds are available?

How do you run tests?

Can you please update the Haskell.nix documentation to reflect this issue?

tscholak avatar Feb 27 '22 15:02 tscholak

$ nix build .#checks
error: flake output attribute 'checks' is not a derivation

why?

$ nix build .#[PACKAGE]:test:doctests

builds the doctests, but doesn't run them.

$ nix run .#[PACKAGE]:test:doctests

can't be used, because

doctests: doctests: can't find a package database at dist/package.conf.inplace

tscholak avatar Feb 27 '22 15:02 tscholak

Note that if I remove all systems except the current one from the flake, nix flake check completes as expected, and also runs the doctests.

tscholak avatar Feb 27 '22 15:02 tscholak

I may have found an answer to my question, "how do I run checks?" here: https://github.com/Plutonomicon/plutarch/blob/f8b7eb06184112ae2bebdec5a8156010141a05d5/flake.nix#L600

tscholak avatar Mar 06 '22 22:03 tscholak

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 28 '22 14:09 stale[bot]

You can pass a preferred evalSystem so the IFD will run on that system. For instance you could pass evalSystem = "x86_64-darwin"; or evalSystem = builtins.currentSystem; (requires --impure). This will help make nix flake show work however nix flake check will still want to run the tests on all the supported systems of the flake. So if the flake includes checks for "i686-linux" and there is no builder for that it will fail.

The checks are now also included in haskell.nix project flakes under hydraJobs.checks. So to run a check use:

build .#hydraJobs.checks.[PACKAGE]:test:[TEST].x86_64-linux

hamishmack avatar Oct 04 '22 11:10 hamishmack