Skip to content

Commit

Permalink
Build: enable nix-command on nix path-info call, silence stdout as …
Browse files Browse the repository at this point in the history
…well

`nix-store -q` (and `--outputs`) doesn't seem to complain if a path
doesn't exist in a store anymore, so let's do it that way.

This approach works fine on Nix 2.3 as well, it only warns about
`experimental-features` being an unknown option, but that's silenced
along with the rest of stderr.

(cherry picked from commit 15b7d91)
  • Loading branch information
Ma27 committed Jan 26, 2024
1 parent 1d1ec0b commit a1a1dbb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/Hydra/Controller/Build.pm
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ sub isValidPathNixCLI {
my $pid = fork();
if (!$pid) {
open STDERR, ">", "/dev/null";
exec "nix", "path-info", $path, "--store", getStoreUri();
open STDOUT, ">", "/dev/null";
exec "nix", "path-info", $path, "--store", getStoreUri(), "--option", "experimental-features", "nix-command";
}
waitpid $pid, 0;
return $? == 0;
Expand Down

0 comments on commit a1a1dbb

Please sign in to comment.