nix icon indicating copy to clipboard operation
nix copied to clipboard

nix flake show: don't evaluate derivations for foreign systems by default

Open max-privatevoid opened this issue 3 years ago • 5 comments

Simple implementation of the idea, based on how legacyPackages is handled already. Doesn't cover hydraJobs, unfortunately.

Fixes https://github.com/NixOS/nix/issues/6985

max-privatevoid avatar Sep 01 '22 20:09 max-privatevoid

I like this idea, although it conflicts a bit with the idea that the system hierarchy layer should be special-cased as least as can be. But probably that's worth it.

I think we can easily agree on the fact that the way the system is currently handled has a lot of flaws, and doing special handling it will be the only way around it (besides rewriting "flakespec" from scratch).

NobbZ avatar Sep 05 '22 16:09 NobbZ

And I also want to add:

Specialcasing the system within nix' source code wasn't necessary that mouch if we were doing checks and shows in nix expression language, as briefly suggested in #6453 and #6454.

Of course I see, that we would still need to tell the nix expressions what the current system is.

NobbZ avatar Sep 05 '22 20:09 NobbZ

--foreign is not very descriptive as an option name. Maybe --all-systems or something like that?

edolstra avatar Sep 06 '22 11:09 edolstra

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/deduplicating-a-package-definition-between-nixpkgs-and-a-flake/21460/4

nixos-discourse avatar Sep 06 '22 12:09 nixos-discourse

Or maybe --systems=all (default value for flag: --systems=local). That would let us also give a specific list of systems to eval (--systems=x86_64-linux,aarch64-linux).

yajo avatar Sep 22 '22 06:09 yajo

Is there any reason why we need this instead of just catching errors that happen due to not being able to build a drv and omitting those parts of the output?

L-as avatar Oct 26 '22 11:10 L-as

For nix flake show, probably it would be the same. However, for nix flake check we would need a way to check the flake only for the current arch. Otherwise an IFS would always become an error, even if it's not.

yajo avatar Oct 26 '22 11:10 yajo

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/announcing-stacklock2nix-easily-build-a-haskell-project-that-contains-a-stack-yaml-lock-file/23563/5

nixos-discourse avatar Nov 30 '22 10:11 nixos-discourse

Lost ~hour today due to this unexpected behavor while working on https://github.com/cachix/cachix/pull/476

domenkozar avatar Dec 19 '22 11:12 domenkozar

What is stopping this fix from being merged?

adrian-gierakowski avatar Jan 26 '23 23:01 adrian-gierakowski

What is stopping this fix from being merged?

Nothing really.

@max-privatevoid I've merged master back into this and added a few tests. Let me know whether that looks good to you

thufschmitt avatar Jan 27 '23 09:01 thufschmitt

Oh also: I've noticed that this doesn't apply to legacyPackages. Is it intentional?

(I don't think it should be a blocker, and I think it makes sense either way, just wants to make sure it's not an overlook)

thufschmitt avatar Jan 27 '23 09:01 thufschmitt

Thanks for writing the tests. I've added the functionality to legacyPackages as well now. I definitely meant to have the flag work there too, just forgot about it.

max-privatevoid avatar Jan 27 '23 23:01 max-privatevoid

Awesome, thanks. I've just pushed a fix for the tests because they were broken on non-x86_64-linux. If the CI is OK, it'll just merge

thufschmitt avatar Jan 30 '23 09:01 thufschmitt

Thanks for this PR, I am trying to use it to implement the same behavior for nix flake check: https://github.com/NixOS/nix/pull/7759

peterbecich avatar Feb 06 '23 00:02 peterbecich

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nix-2-14-0-released/25900/2

nixos-discourse avatar Feb 28 '23 17:02 nixos-discourse

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nix-team-report-2022-10-2023-03/27486/1

nixos-discourse avatar Apr 21 '23 11:04 nixos-discourse