NixOS/nix
View on GitHubnix path-info --json always return with exit code 0 contradicting docs
Open
#10,886 opened on Jun 10, 2024
buggood first issuenew-cli
Description
Describe the bug
From the docs:
Warning Note that nix path-info does not build or substitute the installables you specify. Thus, if the corresponding store paths don’t already exist, this command will fail. You can use nix build to ensure that they exist.
Steps To Reproduce
nix path-info .#derivation-didnt-build
returns
error: path '/nix/store/qd2prbj1wjbf0r816s60ps15i7hw5l90-nixos-system-unnamed-24.05.20240530.d24e7fd' is not valid
$ echo $?
1
However
nix path-info .#derivation-didnt-build --json
returns
{"/nix/store/qd2prbj1wjbf0r816s60ps15i7hw5l90-nixos-system-unnamed-24.05.20240530.d24e7fd":null}%
$ echo $?
0
Expected behavior
nix path-info --json
should return non-zero exit code if derivation isnt built
nix-env --version output
Additional context
I'm using this to check if a derivation is in cache but this command silently broke broke as I added --json
if ! nix path-info --eval-store auto --store s3://mybucket ; then
nix copy --eval-store --auto --to s3://mybucket
fi
Priorities
Add :+1: to issues you find important.