NixOS/nix

nix path-info --json always return with exit code 0 contradicting docs

Open

#10 886 ouverte le 10 juin 2024

Voir sur GitHub
 (1 commentaire) (0 réactions) (0 assignés)C++ (1 293 forks)batch import
buggood first issuenew-cli

Métriques du dépôt

Stars
 (9 803 stars)
Métriques de merge PR
 (Merge moyen 4j 12h) (86 PRs mergées en 30 j)

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.

Guide contributeur