Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix flake check fails #1386

Closed
tscholak opened this issue Feb 27, 2022 · 6 comments
Closed

nix flake check fails #1386

tscholak opened this issue Feb 27, 2022 · 6 comments

Comments

@tscholak
Copy link

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 NixOS/nix#4265.

What workarounds are available?

How do you run tests?

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

@tscholak
Copy link
Author

tscholak commented Feb 27, 2022

$ 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
Copy link
Author

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
Copy link
Author

tscholak commented Mar 6, 2022

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

@stale
Copy link

stale bot commented Sep 28, 2022

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 stale bot added the wontfix label Sep 28, 2022
@hamishmack
Copy link
Collaborator

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

@peterbecich
Copy link
Contributor

Copied from here

, evalSystem ? builtins.currentSystem or "x86_64-linux"

this appears to work:

hixProject =
  final.haskell-nix.hix.project {
    src = ./.;
    evalSystem = builtins.currentSystem or "x86_64-linux";
  };

On Linux, nix flake check succeeds. On Mac, I think nix flake check --impure succeeds.


This may be relevant:

[flake]: provide builtins.currentSystem as a input to flakes
NixOS/nix#3843

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants