core/pkgs/build-support/fetchpijul/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
1.5 KiB
Nix
Raw Normal View History

2024-05-02 00:46:19 +00:00
{
lib,
stdenvNoCC,
pijul,
cacert,
}:
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;
nativeBuildInputs = [
pijul
cacert
];
strictDeps = true;
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
installPhase = ''
runHook preInstall
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
pijul clone \
''${change:+--change "$change"} \
''${state:+--state "$state"} \
--channel "$channel" \
"$url" \
"$out"
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
runHook postInstall
'';
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
fixupPhase = ''
runHook preFixup
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
rm -rf "$out/.pijul"
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
runHook postFixup
'';
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
outputHashAlgo = if hash != "" then null else "sha256";
outputHashMode = "recursive";
outputHash = if hash != "" then hash else lib.fakeSha256;
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
inherit
url
change
state
channel
;
2024-06-30 08:12:46 +00:00
2024-05-02 00:46:19 +00:00
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
}
)