I’m trying to create an offline yarn cache for a yarn v2 lock file manually (because v2 doesn’t support fetchYarnDeps).
I referenced other packages doing this and came up with the following:
{
stdenv
, fetchFromGitHub
, git
, openssh
, yarn
, fetchYarnDeps
, keepBuildTree
, buildNpmPackage
, nodejs
, cacert
, gitMinimal
, python3
, jq
, moreutils
}:
stdenv.mkDerivation rec {
version = "1.6.3";
pname = "Cider";
src = fetchFromGitHub {
owner = "ciderapp";
repo = pname;
rev = "v${version}";
sha256 = "sha256-kjF3QvKmc6DY2ETwDPp4HUlg1uuFXx04lksqevVZCho=";
};
offlineCache = stdenv.mkDerivation {
name = "cider-${version}-offline-cache";
inherit src;
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
nativeBuildInputs = [
yarn
cacert # needed for git
gitMinimal # needed to download git dependencies
nodejs # needed for npm to download git dependencies
python3
jq
moreutils
];
buildPhase = ''
runHook preBuild
export HOME=$(mktemp -d)
yarn config set enableTelemetry 0
yarn config set cacheFolder $out
yarn config set --json supportedArchitectures.os '[ "linux" ]'
yarn config set --json supportedArchitectures.cpu '[ "arm", "arm64", "ia32", "x64"]'
yarn --verbose ## THIS COMMAND PRODUCES AN EMPTY CACHE SO THE DERIVATION IS NOT BUILT AND IT DOESN'T GET FURTHER
runHook postBuild
'';
dontConfigure = true;
dontInstall = true;
dontFixup = true;
outputHashMode = "recursive";
outputHash = "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo=";
};
nativeBuildInputs = [
yarn
keepBuildTree
];
buildPhase = ''
export HOME=$(mktemp -d)
yarn config set enableTelemetry 0
yarn config set cacheFolder ${offlineCache}
yarn install --offline
yarn dist -l
'';
}
But it only produces an empty folder that doesn’t build into that derivation. Plugging in a different github repo into my code works, so it’s something with that repos yarn.lock, but I can’t figure out what.
This is the end of the log, seemingly no errors, but the cache folder is empty:
verbose 36.304831628 Copying "/build/tmp.9d1p4xYnMU/.cache/yarn/v6/npm-protobufjs-6.11.4-29a412c38bf70d89e537b6d02d904a6f448173aa-integrity/node_modules/protobufjs/cli/node_modules/jsdoc/templates/default/static/fonts/OpenSans-LightItalic-webfont.woff" to "/build/source/node_modules/protobufjs/cli/node_modules/jsdoc/templates/default/static/fonts/OpenSans-LightItalic-webfont.woff".
verbose 36.304856129 Copying "/build/tmp.9d1p4xYnMU/.cache/yarn/v6/npm-protobufjs-6.11.4-29a412c38bf70d89e537b6d02d904a6f448173aa-integrity/node_modules/protobufjs/cli/node_modules/jsdoc/templates/default/static/fonts/OpenSans-Regular-webfont.woff" to "/build/source/node_modules/protobufjs/cli/node_modules/jsdoc/templates/default/static/fonts/OpenSans-Regular-webfont.woff".
verbose 36.304878964 Copying "/build/tmp.9d1p4xYnMU/.cache/yarn/v6/npm-protobufjs-6.11.4-29a412c38bf70d89e537b6d02d904a6f448173aa-integrity/node_modules/protobufjs/cli/node_modules/jsdoc/templates/default/static/scripts/prettify/Apache-License-2.0.txt" to "/build/source/node_modules/protobufjs/cli/node_modules/jsdoc/templates/default/static/scripts/prettify/Apache-License-2.0.txt".
verbose 36.304903881 Copying "/build/tmp.9d1p4xYnMU/.cache/yarn/v6/npm-protobufjs-6.11.4-29a412c38bf70d89e537b6d02d904a6f448173aa-integrity/node_modules/protobufjs/cli/node_modules/jsdoc/templates/default/static/scripts/prettify/lang-css.js" to "/build/source/node_modules/protobufjs/cli/node_modules/jsdoc/templates/default/static/scripts/prettify/lang-css.js".
verbose 36.304927591 Copying "/build/tmp.9d1p4xYnMU/.cache/yarn/v6/npm-protobufjs-6.11.4-29a412c38bf70d89e537b6d02d904a6f448173aa-integrity/node_modules/protobufjs/cli/node_modules/jsdoc/templates/default/static/scripts/prettify/prettify.js" to "/build/source/node_modules/protobufjs/cli/node_modules/jsdoc/templates/default/static/scripts/prettify/prettify.js".
[] 0/2659[] 2124/2659[5/5] Building fresh packages...
[] 2659/2659verbose 36.603378896
verbose 36.620700032
verbose 39.179257474 gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@20.15.1 | linux | arm64
gyp info find Python using Python version 3.11.9 found at "/nix/store/qjaqbkm8z87iqj34rj1862ld60r7ikcn-python3-3.11.9/bin/python3"
gyp http GET https://nodejs.org/download/release/v20.15.1/node-v20.15.1-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v20.15.1/node-v20.15.1-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v20.15.1/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v20.15.1/SHASUMS256.txt
gyp info spawn /nix/store/qjaqbkm8z87iqj34rj1862ld60r7ikcn-python3-3.11.9/bin/python3
gyp info spawn args [
gyp info spawn args '/nix/store/zdslzib6494c92dv153bxxmm3wxhj18i-nodejs-20.15.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/build/source/node_modules/usocket/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/nix/store/zdslzib6494c92dv153bxxmm3wxhj18i-nodejs-20.15.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/build/tmp.9d1p4xYnMU/.cache/node-gyp/20.15.1/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/build/tmp.9d1p4xYnMU/.cache/node-gyp/20.15.1',
gyp info spawn args '-Dnode_gyp_dir=/nix/store/zdslzib6494c92dv153bxxmm3wxhj18i-nodejs-20.15.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/build/tmp.9d1p4xYnMU/.cache/node-gyp/20.15.1/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/build/source/node_modules/usocket',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/build/source/node_modules/usocket/build'
CXX(target) Release/obj.target/uwrap/src/uwrap.o
SOLINK_MODULE(target) Release/obj.target/uwrap.node
COPY Release/uwrap.node
make: Leaving directory '/build/source/node_modules/usocket/build'
gyp info ok
verbose 39.211709079 gyp info it worked if it ends with ok
gyp info using node-gyp@10.1.0
gyp info using node@20.15.1 | linux | arm64
gyp info find Python using Python version 3.11.9 found at "/nix/store/qjaqbkm8z87iqj34rj1862ld60r7ikcn-python3-3.11.9/bin/python3"
gyp http GET https://nodejs.org/download/release/v20.15.1/node-v20.15.1-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v20.15.1/node-v20.15.1-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v20.15.1/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v20.15.1/SHASUMS256.txt
gyp info spawn /nix/store/qjaqbkm8z87iqj34rj1862ld60r7ikcn-python3-3.11.9/bin/python3
gyp info spawn args [
gyp info spawn args '/nix/store/zdslzib6494c92dv153bxxmm3wxhj18i-nodejs-20.15.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/build/source/node_modules/airtunes2/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/nix/store/zdslzib6494c92dv153bxxmm3wxhj18i-nodejs-20.15.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/build/tmp.9d1p4xYnMU/.cache/node-gyp/20.15.1/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/build/tmp.9d1p4xYnMU/.cache/node-gyp/20.15.1',
gyp info spawn args '-Dnode_gyp_dir=/nix/store/zdslzib6494c92dv153bxxmm3wxhj18i-nodejs-20.15.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/build/tmp.9d1p4xYnMU/.cache/node-gyp/20.15.1/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/build/source/node_modules/airtunes2',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/build/source/node_modules/airtunes2/build'
CXX(target) Release/obj.target/airtunes/src/codec.o
../src/codec.cc: In function 'void nodeairtunes::EncodeALAC(const v8::FunctionCallbackInfo<v8::Value>&)':
../src/codec.cc:42:35: warning: ignoring return value of 'bool v8::MaybeLocal<F>::ToLocal(v8::Local<S>*) const [with S = v8::Object; T = v8::Object]' declared with attribute 'warn_unused_result' [-Wunused-result]
42 | pcmBuffer->ToObject(ctx).ToLocal(&pcmObj);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
../src/codec.cc:47:36: warning: ignoring return value of 'bool v8::MaybeLocal<F>::ToLocal(v8::Local<S>*) const [with S = v8::Object; T = v8::Object]' declared with attribute 'warn_unused_result' [-Wunused-result]
47 | alacBuffer->ToObject(ctx).ToLocal(&alacObj);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
../src/codec.cc: In function 'void nodeairtunes::EncryptAES(const v8::FunctionCallbackInfo<v8::Value>&)':
../src/codec.cc:137:36: warning: ignoring return value of 'bool v8::MaybeLocal<F>::ToLocal(v8::Local<S>*) const [with S = v8::Object; T = v8::Object]' declared with attribute 'warn_unused_result' [-Wunused-result]
137 | alacBuffer->ToObject(ctx).ToLocal(&alacObj);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
../src/codec.cc: At global scope:
../src/codec.cc:17:12: warning: 'kFramesPerPacket' defined but not used [-Wunused-variable]
17 | static int kFramesPerPacket = 352;
| ^~~~~~~~~~~~~~~~
CXX(target) Release/obj.target/airtunes/src/bindings.o
In file included from ../src/bindings.cc:2:
/build/tmp.9d1p4xYnMU/.cache/node-gyp/20.15.1/include/node/node.h:1228:7: warning: cast between incompatible function types from 'void (*)(v8::Local<v8::Object>)' to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
1228 | (node::addon_register_func) (regfunc), \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/tmp.9d1p4xYnMU/.cache/node-gyp/20.15.1/include/node/node.h:1262:3: note: in expansion of macro 'NODE_MODULE_X'
1262 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
| ^~~~~~~~~~~~~
../src/bindings.cc:29:1: note: in expansion of macro 'NODE_MODULE'
29 | NODE_MODULE(airtunes, nodeairtunes::Initialize);
| ^~~~~~~~~~~
CC(target) Release/obj.target/airtunes/src/aes_utils.o
CC(target) Release/obj.target/airtunes/src/base64.o
SOLINK_MODULE(target) Release/obj.target/airtunes.node
COPY Release/airtunes.node
make: Leaving directory '/build/source/node_modules/airtunes2/build'
gyp info ok
success Saved lockfile.
Done in 39.27s.
buildPhase completed in 40 seconds
error: builder for '/nix/store/ldhcpq4b3r0xiwg7gljplfxq096gm2nj-cider-1.6.3-offline-cache.drv' failed to produce output path for output 'out' at '/nix/store/ldhcpq4b3r0xiwg7gljplfxq096gm2nj-cider-1.6.3-offline-cache.drv.chroot/root/nix/store/rb4qlr7a4b37qi70l3kr4ciiv35d32zp-cider-1.6.3-offline-cache'
error: 1 dependencies of derivation '/nix/store/5gannmkp0nydzhlcbcd37xcvfgiz3px0-Cider-1.6.3.drv' failed to build