From 549a209f96bbd9f3a62f50cc2a075bdb61cf295c Mon Sep 17 00:00:00 2001 From: ·𐑑𐑴𐑕𐑑𐑩𐑀 Date: Tue, 23 Dec 2025 06:22:23 +0000 Subject: nix dep: add dash-nix --- nix/tamal/default.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'nix/tamal/default.nix') diff --git a/nix/tamal/default.nix b/nix/tamal/default.nix index a995c23..ee07ccd 100644 --- a/nix/tamal/default.nix +++ b/nix/tamal/default.nix @@ -84,6 +84,40 @@ let ${hash.al} = hash.vl; } // lib.optionalAttrs (builtins.length kind.ms > 0) { urls = kind.ms; }; + fetch-darcs = {name, kind, hash}: + let + using-mirrors = kind ? ms && (builtins.length kind.ms) > 0; + mirror-support = pkgs.fetchdarcs.__functionArgs ? "mirrors"; + reference = + let + type = builtins.elemAt kind.rf 0; + value = builtins.elemAt kind.rf 1; + in + if type == 0 then + let path = builtins.elemAt value 1; in + assert (lib.hasSuffix ".txt" path); + let + txt-files = lib.sourceFilesBySuffices ./. [ ".txt" ]; + dir = lib.fileset.toSource { + root = ./.; + fileset = lib.fileset.fromSource txt-files; + }; + in + {context = "${dir}/${path}";} + else if type == 1 then + {rev = value;} + else + throw "Invalid Darcs reference"; + in + lib.warnIf (using-mirrors && !mirror-support) + "Upstream pkgs.fetchdarcs doesn’t yet support mirrors for γ€Œ${name}」" + pkgs.fetchdarcs ({ + url = kind.rp; + ${hash.al} = hash.vl; + } // reference // lib.optionalAttrs (using-mirrors && mirror-support){ + mirrors = kind.ms; + }); + to-input = name: input: let k = builtins.head input.kd; in if k == 1 then @@ -92,6 +126,12 @@ let kind = builtins.elemAt input.kd 1; hash = input.ha; } +else if k == 3 then + fetch-darcs { + inherit name; + kind = builtins.elemAt input.kd 1; + hash = input.ha; + } else throw "Unsupported input kind β€œ${builtins.toString k}”."; in -- cgit v1.2.3