mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 11:40:45 +00:00
build-support: Add fetchpijul function.
This commit is contained in:
parent
93d6f73da1
commit
080e97c7f9
56
pkgs/build-support/fetchpijul/default.nix
Normal file
56
pkgs/build-support/fetchpijul/default.nix
Normal file
|
@ -0,0 +1,56 @@
|
|||
{ lib, stdenvNoCC, pijul }:
|
||||
|
||||
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 ];
|
||||
|
||||
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
|
||||
'';
|
||||
|
||||
outputHashAlgo = if hash != "" then null else "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = if hash != "" then
|
||||
hash
|
||||
else
|
||||
lib.fakeSha256;
|
||||
|
||||
inherit url change state channel;
|
||||
}
|
||||
)
|
|
@ -899,6 +899,8 @@ with pkgs;
|
|||
|
||||
fetchMavenArtifact = callPackage ../build-support/fetchmavenartifact { };
|
||||
|
||||
fetchpijul = callPackage ../build-support/fetchpijul { };
|
||||
|
||||
inherit (callPackage ../build-support/node/fetch-yarn-deps { })
|
||||
prefetch-yarn-deps
|
||||
fetchYarnDeps;
|
||||
|
|
Loading…
Reference in a new issue