`nix flake check` fails
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?
$ 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
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.
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
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.
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