fetchYarnDeps: support passing src attribute (#193047)

main
Yureka 2 years ago committed by GitHub
parent 770492307c
commit aa3dc6440e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      pkgs/build-support/node/fetch-yarn-deps/default.nix

@ -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…
Cancel
Save