mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
fetchYarnDeps: support passing src attribute (#193047)
This commit is contained in:
parent
770492307c
commit
aa3dc6440e
@ -42,31 +42,36 @@ in {
|
||||
fetchYarnDeps = let
|
||||
f = {
|
||||
name ? "offline",
|
||||
yarnLock,
|
||||
src ? null,
|
||||
hash ? "",
|
||||
sha256 ? "",
|
||||
}: let
|
||||
...
|
||||
}@args: let
|
||||
hash_ =
|
||||
if hash != "" then { outputHashAlgo = null; outputHash = hash; }
|
||||
else if sha256 != "" then { outputHashAlgo = "sha256"; outputHash = sha256; }
|
||||
else { outputHashAlgo = "sha256"; outputHash = lib.fakeSha256; };
|
||||
in stdenv.mkDerivation {
|
||||
in stdenv.mkDerivation ({
|
||||
inherit name;
|
||||
|
||||
dontUnpack = true;
|
||||
dontUnpack = src == null;
|
||||
dontInstall = true;
|
||||
|
||||
nativeBuildInputs = [ prefetch-yarn-deps ];
|
||||
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
yarnLock=''${yarnLock:=$PWD/yarn.lock}
|
||||
mkdir -p $out
|
||||
(cd $out; prefetch-yarn-deps --verbose --builder ${yarnLock})
|
||||
(cd $out; prefetch-yarn-deps --verbose --builder $yarnLock)
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
outputHashMode = "recursive";
|
||||
inherit (hash_) outputHashAlgo outputHash;
|
||||
};
|
||||
} // hash_ // (removeAttrs args ["src" "name" "hash" "sha256"]));
|
||||
|
||||
in lib.setFunctionArgs f (lib.functionArgs f) // {
|
||||
tests = callPackage ./tests {};
|
||||
|
Loading…
Reference in New Issue
Block a user