Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenvNoCC,
4 pijul,
5 cacert,
6}:
7
8lib.makeOverridable (
9 {
10 url,
11 hash ? "",
12 change ? null,
13 state ? null,
14 channel ? "main",
15 name ? "fetchpijul",
16 # TODO: Changes in pijul are unordered so there's many ways to end up with the same repository state.
17 # This makes leaveDotPijul unfeasible to implement until pijul CLI implements
18 # a way of reordering changes to sort them in a consistent and deterministic manner.
19 # leaveDotPijul ? false
20 }:
21 if change != null && state != null then
22 throw "Only one of 'change' or 'state' can be set"
23 else
24 stdenvNoCC.mkDerivation {
25 inherit name;
26 nativeBuildInputs = [
27 pijul
28 cacert
29 ];
30 strictDeps = true;
31
32 dontUnpack = true;
33 dontConfigure = true;
34 dontBuild = true;
35
36 installPhase = ''
37 runHook preInstall
38
39 pijul clone \
40 ''${change:+--change "$change"} \
41 ''${state:+--state "$state"} \
42 --channel "$channel" \
43 "$url" \
44 "$out"
45
46 runHook postInstall
47 '';
48
49 fixupPhase = ''
50 runHook preFixup
51
52 rm -rf "$out/.pijul"
53
54 runHook postFixup
55 '';
56
57 outputHashAlgo = null;
58 outputHashMode = "recursive";
59 outputHash = if hash != "" then hash else lib.fakeHash;
60
61 inherit
62 url
63 change
64 state
65 channel
66 ;
67
68 impureEnvVars = lib.fetchers.proxyImpureEnvVars;
69 }
70)