diff options
| author | Β·ππ΄πππ©π€ | 2025-12-23 06:22:23 +0000 |
|---|---|---|
| committer | Β·ππ΄πππ©π€ | 2025-12-23 06:22:23 +0000 |
| commit | 549a209f96bbd9f3a62f50cc2a075bdb61cf295c (patch) | |
| tree | 6c4dd2be7aa8c6c53f566c3baf4c5d8fe95c47ed /nix/tamal/default.nix | |
| parent | 7d395daf34f89f1e6628f7871768d06eb0d16187 (diff) | |
| download | nixtaml-549a209f96bbd9f3a62f50cc2a075bdb61cf295c.tar nixtaml-549a209f96bbd9f3a62f50cc2a075bdb61cf295c.tar.gz nixtaml-549a209f96bbd9f3a62f50cc2a075bdb61cf295c.tar.bz2 nixtaml-549a209f96bbd9f3a62f50cc2a075bdb61cf295c.tar.lz nixtaml-549a209f96bbd9f3a62f50cc2a075bdb61cf295c.tar.xz nixtaml-549a209f96bbd9f3a62f50cc2a075bdb61cf295c.tar.zst nixtaml-549a209f96bbd9f3a62f50cc2a075bdb61cf295c.zip | |
nix dep: add dash-nix
Diffstat (limited to 'nix/tamal/default.nix')
| -rw-r--r-- | nix/tamal/default.nix | 40 |
1 files changed, 40 insertions, 0 deletions
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 |
