1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-08 06:53:54 +02:00

Merge pull request #9242 from obsidiansystems/path-info-map

Make `nix path-info --json` return an object not array
This commit is contained in:
Théophane Hufschmitt 2023-11-06 18:00:42 +01:00 committed by GitHub
commit 06d0d51895
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 578 additions and 126 deletions

View file

@ -120,6 +120,7 @@ nix_tests = \
flakes/show.sh \
impure-derivations.sh \
path-from-hash-part.sh \
path-info.sh \
toString-path.sh \
read-only-store.sh \
nested-sandboxing.sh \

View file

@ -0,0 +1,23 @@
source common.sh
echo foo > $TEST_ROOT/foo
foo=$(nix store add-file $TEST_ROOT/foo)
echo bar > $TEST_ROOT/bar
bar=$(nix store add-file $TEST_ROOT/bar)
echo baz > $TEST_ROOT/baz
baz=$(nix store add-file $TEST_ROOT/baz)
nix-store --delete "$baz"
diff --unified --color=always \
<(nix path-info --json "$foo" "$bar" "$baz" |
jq --sort-keys 'map_values(.narHash)') \
<(jq --sort-keys <<-EOF
{
"$foo": "sha256-QvtAMbUl/uvi+LCObmqOhvNOapHdA2raiI4xG5zI5pA=",
"$bar": "sha256-9fhYGu9fqxcQC2Kc81qh2RMo1QcLBUBo8U+pPn+jthQ=",
"$baz": null
}
EOF
)