1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-18 08:19:35 +01:00

JSON for Hash now has to be Base16

Fix #14532.

As discussed on the call today:

1. We'll stick with `format = "base16"` and `hash = "<hash>"`, not do
   `base16 = "<hash>"`, in order to be forward compatible with
   supporting more versioning formats.

   The motivation we discussed for someday *possibly* doing this is
   making it easier to write very slap-dash lang2nix tools that create
   (not consume) derivations with dynamic derivations.

2. We will remove support for non-base16 (and make that the default, not
   base64) in `Hash`, so this is strictly forward contingency, *not*
   yet something we support. (And also not something we have concrete
   plans to start supporting.)
This commit is contained in:
John Ericson 2025-11-10 16:07:28 -05:00
parent 750306234d
commit 13b44742a4
22 changed files with 79 additions and 101 deletions

View file

@ -49,12 +49,12 @@ try2 () {
nix path-info --json "$path" | jq -e \
--arg algo "$hashAlgo" \
--arg hash "$(nix hash convert --to base64 "$hashAlgo:$hashFromGit")" \
--arg hash "$hashFromGit" \
'.[].ca == {
method: "git",
hash: {
algorithm: $algo,
format: "base64",
format: "base16",
hash: $hash
},
}'