`generateNixPathFromInputs` should check for `default.nix` file instead of for package set
lilyball opened this issue · 3 comments
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
.
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).
Yeah, good point. Will implement it this weekend
I think it's fixed by #105?