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

Add command 'nix store path-from-hash-part'

This exposes the Store::queryPathFromHashPart() interface in the CLI.
This commit is contained in:
Eelco Dolstra 2022-10-18 16:42:06 +02:00
parent a324e9a5c8
commit 61f89e954a
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 71 additions and 1 deletions

View file

@ -0,0 +1,10 @@
source common.sh
path=$(nix build --no-link --print-out-paths -f simple.nix)
hash_part=$(basename $path)
hash_part=${hash_part:0:32}
path2=$(nix store path-from-hash-part $hash_part)
[[ $path = $path2 ]]