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

generateNixPathFromInputs should check for default.nix file instead of for package set #107

Closed
lilyball opened this issue Dec 2, 2021 · 3 comments

Comments

@lilyball
Copy link

lilyball commented Dec 2, 2021

nix.generateNixPathFromInputs only adds inputs to NIX_PATH if they have a packages or legacyPackages output. This is a rather curious restriction, as the existence of such a package set does not prove that the flake source can be imported directly. It also means that flakes that can be imported, such as nix-darwin, don't end up in NIX_PATH as they don't have a package set.

Instead of testing for the package set, it should check if the flake has a default.nix file. Unfortunately I don't think Nix lets you test if a file exists, so this might require using an activation script instead of config.environment.etc. Though perhaps setting environment.etc."nix/input".source to a derivation whose outPath is a directory of symlinks might work? That way the derivation build script can test the inputs for a default.nix.

@lilyball
Copy link
Author

lilyball commented Dec 2, 2021

I hacked this together myself, and I can confirm that environment.etc."nix/input".source = pkgs.runCommandNoCC works to build a directory. There may be an issue activating the result for anyone who already has the existing /etc/nix/inputs as a directory though (this is true for nix-darwin, I don't know if nixos's environment.etc activation is any smarter, though my belief is nix-darwin just copied it from nixos).

@gytis-ivaskevicius
Copy link
Owner

Yeah, good point. Will implement it this weekend

@gytis-ivaskevicius
Copy link
Owner

I think it's fixed by #105?

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

2 participants