diff options
| author | ยท๐๐ด๐๐๐ฉ๐ค | 2025-12-10 20:51:40 +0000 |
|---|---|---|
| committer | ยท๐๐ด๐๐๐ฉ๐ค | 2025-12-10 20:51:40 +0000 |
| commit | 4d23231ee05ace175f0694114572e298150a467d (patch) | |
| tree | 20f32e776ba2b0fe5abd623b8873aff27016b582 | |
| parent | 2b69aa9def94d45b641d266bf9b3549e384bd7a1 (diff) | |
| download | nixtaml-4d23231ee05ace175f0694114572e298150a467d.tar nixtaml-4d23231ee05ace175f0694114572e298150a467d.tar.gz nixtaml-4d23231ee05ace175f0694114572e298150a467d.tar.bz2 nixtaml-4d23231ee05ace175f0694114572e298150a467d.tar.lz nixtaml-4d23231ee05ace175f0694114572e298150a467d.tar.xz nixtaml-4d23231ee05ace175f0694114572e298150a467d.tar.zst nixtaml-4d23231ee05ace175f0694114572e298150a467d.zip | |
manifest: do hash algo
| -rw-r--r-- | doc/manifest.rst | 1 | ||||
| -rw-r--r-- | lib/manifest.ml | 28 | ||||
| -rw-r--r-- | nix/tamal/manifest.kdl | 2 |
3 files changed, 13 insertions, 18 deletions
diff --git a/doc/manifest.rst b/doc/manifest.rst index 1c9e4c2..d6b7d72 100644 --- a/doc/manifest.rst +++ b/doc/manifest.rst @@ -45,6 +45,7 @@ Default ``manifest.kdl`` archive { url "https://github.com/NixOS/nixpkgs/archive/{{cmd_value}}.tar.gz" } + hash algorithm=SHA256 latest-cmd { $ git ls-remote --heads "https://github.com/NixOS/nixpkgs.git" --refs "refs/heads/nixos-unstable" | cut -f1 diff --git a/lib/manifest.ml b/lib/manifest.ml index 725cbc5..8cadce5 100644 --- a/lib/manifest.ml +++ b/lib/manifest.ml @@ -371,23 +371,17 @@ module Hash = struct let codec : t Util.KDL.codec = { to_kdl = (fun hash -> let open Kdl in - if hash.algorithm != Input.Hash.default_algorithm || Option.is_some hash.expected then - let props = - match hash.expected with - | None -> [] - | Some exp_hash -> - ["expected", (None, `String exp_hash)] - in - let props = - if hash.algorithm != Input.Hash.default_algorithm then - let algo_str = Input.Hash.algorithm_to_string hash.algorithm in - ("algorithm", (None, `String algo_str)) :: props - else - props - in - [node "hash" ~props []] - else - [] + let props = + match hash.expected with + | None -> [] + | Some exp_hash -> + ["expected", (None, `String exp_hash)] + in + let props = + let algo_str = Input.Hash.algorithm_to_string hash.algorithm in + ("algorithm", (None, `String algo_str)) :: props + in + [node "hash" ~props []] ); of_kdl = (fun kdl -> let open Util.KDL.L in diff --git a/nix/tamal/manifest.kdl b/nix/tamal/manifest.kdl index 6dfe609..d85e2f0 100644 --- a/nix/tamal/manifest.kdl +++ b/nix/tamal/manifest.kdl @@ -7,10 +7,10 @@ inputs { archive { url "https://github.com/NixOS/nixpkgs/archive/{{cmd_value}}.tar.gz" } + hash algorithm=SHA256 latest-cmd { $ git ls-remote --heads "https://github.com/NixOS/nixpkgs.git" --refs "refs/heads/nixpkgs-unstable" | cut -f1 } } } - |
