2023-12-06 17:35:20 +00:00
|
|
|
{ lib, stdenvNoCC, pijul, cacert }:
|
2023-06-30 22:05:30 +00:00
|
|
|
|
|
|
|
lib.makeOverridable (
|
|
|
|
{ url
|
|
|
|
, hash ? ""
|
|
|
|
, change ? null
|
|
|
|
, state ? null
|
|
|
|
, channel ? "main"
|
|
|
|
, name ? "fetchpijul"
|
|
|
|
, # TODO: Changes in pijul are unordered so there's many ways to end up with the same repository state.
|
|
|
|
# This makes leaveDotPijul unfeasible to implement until pijul CLI implements
|
|
|
|
# a way of reordering changes to sort them in a consistent and deterministic manner.
|
|
|
|
# leaveDotPijul ? false
|
|
|
|
}:
|
|
|
|
if change != null && state != null then
|
|
|
|
throw "Only one of 'change' or 'state' can be set"
|
|
|
|
else
|
|
|
|
stdenvNoCC.mkDerivation {
|
|
|
|
inherit name;
|
2023-12-06 17:35:20 +00:00
|
|
|
nativeBuildInputs = [ pijul cacert ];
|
2023-12-06 17:38:19 +00:00
|
|
|
strictDeps = true;
|
2023-06-30 22:05:30 +00:00
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
pijul clone \
|
|
|
|
''${change:+--change "$change"} \
|
|
|
|
''${state:+--state "$state"} \
|
|
|
|
--channel "$channel" \
|
|
|
|
"$url" \
|
|
|
|
"$out"
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
fixupPhase = ''
|
|
|
|
runHook preFixup
|
|
|
|
|
|
|
|
rm -rf "$out/.pijul"
|
|
|
|
|
|
|
|
runHook postFixup
|
|
|
|
'';
|
|
|
|
|
2024-09-15 22:28:44 +00:00
|
|
|
outputHashAlgo = null;
|
2023-06-30 22:05:30 +00:00
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHash = if hash != "" then
|
|
|
|
hash
|
|
|
|
else
|
2024-09-15 22:28:44 +00:00
|
|
|
lib.fakeHash;
|
2023-06-30 22:05:30 +00:00
|
|
|
|
|
|
|
inherit url change state channel;
|
2023-12-06 17:35:20 +00:00
|
|
|
|
|
|
|
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
|
2023-06-30 22:05:30 +00:00
|
|
|
}
|
|
|
|
)
|