nixos-module/pins.nix

27 lines
785 B
Nix
Raw Normal View History

# this is a custom pinning tool, written because npins doesn't have narHash
# compatible output for git inputs, and also doesn't support the Nix immutable
# tarball protocol
let
pins = builtins.fromJSON (builtins.readFile ./pins.json);
fetchPin = args@{ kind, ... }:
if kind == "git" then
builtins.fetchGit
{
name = "source";
url = args.url;
ref = args.ref;
rev = args.rev;
narHash = args.nar_hash;
}
else if kind == "tarball" then
2024-05-27 19:03:12 +00:00
args // {
outPath = builtins.fetchTarball {
name = "source";
url = args.locked_url;
sha256 = args.nar_hash;
2024-05-27 19:03:12 +00:00
};
}
else builtins.throw "unsupported input type ${kind}";
in
builtins.mapAttrs (_: fetchPin) pins