1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

nix hash path, and preperatory refactors

- `nix store add` supports text hashing

  With functional test ensuring it matches `builtins.toFile`.

- Factored-out flags for both commands

- Move all common reusable flags to `libcmd`

  - They are not part of the *definition* of the CLI infra, just a usag
    of it.

  - The `libstore` flag couldn't go in `args.hh` in libutil anyways,
    would be awkward for it to live alone

- Shuffle around `Cmd*` hierarchy so flags for deprecated commands don't
  end up on the new ones
This commit is contained in:
John Ericson 2024-01-19 21:11:56 -05:00
parent 3f5d7afe46
commit efd36b49e8
9 changed files with 245 additions and 138 deletions

View file

@ -45,3 +45,8 @@ clearStore
[[ "$path1" == "$path2" ]]
path4=$(nix store add --mode flat --hash-algo sha1 ./dummy)
)
(
path1=$(nix store add --mode text ./dummy)
path2=$(nix eval --impure --raw --expr 'builtins.toFile "dummy" (builtins.readFile ./dummy)')
[[ "$path1" == "$path2" ]]
)