7 nodejsInstallExecutables,
24 yarnpkg-lockfile-tar = fetchurl {
25 url = "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz";
26 hash = "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==";
29 tests = callPackage ./tests { };
32 prefetch-yarn-deps = stdenv.mkDerivation {
33 name = "prefetch-yarn-deps";
38 nativeBuildInputs = [ makeWrapper ];
39 buildInputs = [ nodejs-slim ];
44 mkdir -p $out/bin $out/libexec
46 tar --strip-components=1 -xf ${yarnpkg-lockfile-tar} package/index.js
47 mv index.js $out/libexec/yarnpkg-lockfile.js
48 cp ${./common.js} $out/libexec/common.js
49 cp ${./index.js} $out/libexec/index.js
51 patchShebangs $out/libexec
52 makeWrapper $out/libexec/index.js $out/bin/prefetch-yarn-deps \
69 fixup-yarn-lock = stdenv.mkDerivation {
70 name = "fixup-yarn-lock";
75 nativeBuildInputs = [ makeWrapper ];
76 buildInputs = [ nodejs-slim ];
81 mkdir -p $out/bin $out/libexec
83 tar --strip-components=1 -xf ${yarnpkg-lockfile-tar} package/index.js
84 mv index.js $out/libexec/yarnpkg-lockfile.js
85 cp ${./common.js} $out/libexec/common.js
86 cp ${./fixup.js} $out/libexec/fixup.js
88 patchShebangs $out/libexec
89 makeWrapper $out/libexec/fixup.js $out/bin/fixup-yarn-lock
113 outputHashAlgo = null;
116 else if sha256 != "" then
118 outputHashAlgo = "sha256";
123 outputHashAlgo = "sha256";
124 outputHash = lib.fakeSha256;
127 stdenv.mkDerivation (
131 dontUnpack = src == null;
134 nativeBuildInputs = [
138 GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
139 NODE_EXTRA_CA_CERTS = "${cacert}/etc/ssl/certs/ca-bundle.crt";
144 yarnLock=''${yarnLock:=$PWD/yarn.lock}
146 (cd $out; prefetch-yarn-deps --verbose --builder $yarnLock)
151 outputHashMode = "recursive";
154 // (removeAttrs args (
160 ++ (lib.optional (src == null) "src")
164 lib.setFunctionArgs f (lib.functionArgs f) // { inherit tests; };
166 yarnConfigHook = makeSetupHook {
167 name = "yarn-config-hook";
168 propagatedBuildInputs = [
173 description = "Install nodejs dependencies from an offline yarn cache produced by fetchYarnDeps";
175 } ./yarn-config-hook.sh;
177 yarnBuildHook = makeSetupHook {
178 name = "yarn-build-hook";
180 description = "Run yarn build in buildPhase";
182 } ./yarn-build-hook.sh;
184 yarnInstallHook = makeSetupHook {
185 name = "yarn-install-hook";
186 propagatedBuildInputs = [
189 nodejsInstallExecutables
194 } ./yarn-install-hook.sh;