NixOS/nix

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

Open

#10,886 创建于 2024年6月10日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)C++ (9,803 star) (1,293 fork)batch import
buggood first issuenew-cli

描述

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.

贡献者指南