diff --git a/examples/nodejs_workspace-example/flake.nix b/examples/nodejs_workspace/flake.nix similarity index 100% rename from examples/nodejs_workspace-example/flake.nix rename to examples/nodejs_workspace/flake.nix diff --git a/examples/nodejs_workspace-example/package.json b/examples/nodejs_workspace/package.json similarity index 100% rename from examples/nodejs_workspace-example/package.json rename to examples/nodejs_workspace/package.json diff --git a/examples/nodejs_workspace-example/packages/cli/bin/cli.js b/examples/nodejs_workspace/packages/cli/bin/cli.js similarity index 100% rename from examples/nodejs_workspace-example/packages/cli/bin/cli.js rename to examples/nodejs_workspace/packages/cli/bin/cli.js diff --git a/examples/nodejs_workspace-example/packages/cli/package.json b/examples/nodejs_workspace/packages/cli/package.json similarity index 100% rename from examples/nodejs_workspace-example/packages/cli/package.json rename to examples/nodejs_workspace/packages/cli/package.json diff --git a/examples/nodejs_workspace-example/packages/lib/package.json b/examples/nodejs_workspace/packages/lib/package.json similarity index 100% rename from examples/nodejs_workspace-example/packages/lib/package.json rename to examples/nodejs_workspace/packages/lib/package.json diff --git a/examples/nodejs_workspace-example/packages/lib/src/main.js b/examples/nodejs_workspace/packages/lib/src/main.js similarity index 100% rename from examples/nodejs_workspace-example/packages/lib/src/main.js rename to examples/nodejs_workspace/packages/lib/src/main.js diff --git a/examples/rust_no-cargo-lock-example/flake.nix b/examples/rust_no-cargo-lock/flake.nix similarity index 100% rename from examples/rust_no-cargo-lock-example/flake.nix rename to examples/rust_no-cargo-lock/flake.nix diff --git a/overrides/nodejs/default.nix b/overrides/nodejs/default.nix index b38d1031e9..7f88c5f95f 100644 --- a/overrides/nodejs/default.nix +++ b/overrides/nodejs/default.nix @@ -284,9 +284,28 @@ in aarch64-darwin = "65b9b3235efdb681e3a4db85068dc9fe6dfbcb7fbb146053c0a534e4b44a2f7a"; headers = "1xnbzskvf8p5a07bha41qqnw1hb68f019qrda3z2jn96m3qnj46r"; }; + "17.4.10" = { + armv7l-linux = "b3e4e44ef4014cd34f8fa1c06fe714d600e0e42e95a152255fa48d7246a47bf8"; + aarch64-linux = "3186b7ac800f421286157c0550a923e5dfc8b0209c0d1ed037a7cd837136113c"; + x86_64-linux = "065fdd554993d9b1e52ad8093e6341d001c219f49d81f32f3dd457f544375380"; + i686-linux = "4b3c6a82a53499a2fecf683d1aa225ba39cebec19f8d65fccf53a53c53ad7d9c"; + x86_64-darwin = "54a773193c479a48f4094e8295dea48f2bc38759d19ce58466f3584797c504d7"; + aarch64-darwin = "f8fbb8f2247e349bdd4b6e991443074c8342da4ca61dcad38c236c6ab52b6055"; + headers = "1308wd86cfnnmj4idw3y96brsjix9pb8hw7y8wrxfh7ml6w1g9x7"; + }; + "18.3.6" = { + armv7l-linux = "78c95b7405c5d49de99c85f39a940e2d2409fa5f0a1c5c6e1fc908188f1180d8"; + aarch64-linux = "359a1682f8d2f083215a8ff6ae3aab0889de4b78a44a8e8ce3095044820b78f1"; + x86_64-linux = "81a04cf093980c36d99df2369d95ab7ed64b496a22125620478ac5d2b2989a28"; + i686-linux = "902e89e40a32c7e6c49d3004a8ddf5e4c4015d0499bfba4827bdfa21280ef7c3"; + x86_64-darwin = "db330f23f1e75c568c0e44e2fc07faa3a4f9fc6a7d3bf29feeb7f624608cb29c"; + aarch64-darwin = "5a62d46c3c45b6e416bf77affccc94e26b7a21ff8bced466036fbe74ff59799a"; + headers = "0wdw9xaxyn7zk6b4x4ldzallggxlxs293fwp6af4fa5a1c295gkn"; + }; }; in { add-binary = { + _condition = pkg: (l.toInt (l.versions.major pkg.version)) > 2; overrideAttrs = old: { postPatch = if pkgs.stdenv.isLinux diff --git a/overrides/nodejs/electron/print-hashes.sh b/overrides/nodejs/electron/print-hashes.sh index 91dd8dc5bf..0a08395c4c 100755 --- a/overrides/nodejs/electron/print-hashes.sh +++ b/overrides/nodejs/electron/print-hashes.sh @@ -20,8 +20,8 @@ SYSTEMS=( [aarch64-darwin]=darwin-arm64 ) -hashfile="$(nix-prefetch-url --print-path "https://github.com/electron/electron/releases/download/v${VERSION}/SHASUMS256.txt" 2>/dev/null | tail -n1)" -headers="$(nix-prefetch-url "https://atom.io/download/electron/v${VERSION}/node-v${VERSION}-headers.tar.gz")" +hashfile="$(nix-prefetch-url --print-path "https://github.com/electron/electron/releases/download/v${VERSION}/SHASUMS256.txt" | tail -n1)" +headers="$(nix-prefetch-url "https://artifacts.electronjs.org/headers/dist/v${VERSION}/node-v${VERSION}-headers.tar.gz")" # Entry similar to the following goes in default.nix: diff --git a/src/apps/translate-index/default.nix b/src/apps/translate-index/default.nix index 3654efbd77..3229d7bef6 100644 --- a/src/apps/translate-index/default.nix +++ b/src/apps/translate-index/default.nix @@ -8,7 +8,7 @@ ... }: let script = writeScript "run-translate" '' - ${translate}/bin/translate $1 $targetDir + ${translate}/bin/translate $1 $targetDir || echo "Failed to translate $1" ''; in utils.writePureShellScriptBin diff --git a/src/fetchers/git/default.nix b/src/fetchers/git/default.nix index 6bf49818d5..badff057b0 100644 --- a/src/fetchers/git/default.nix +++ b/src/fetchers/git/default.nix @@ -26,9 +26,17 @@ in { hasGitRef = inp.ref or null != null; in if isRevGitRef == null && isGitRev rev == null - then throw ''rev must either be a sha1 revision or "refs/heads/branch-name" or "refs/tags/tag-name"'' + then + throw '' + invalid git rev: ${rev} + rev must either be a sha1 revision or "refs/heads/branch-name" or "refs/tags/tag-name" + '' else if hasGitRef && isGitRef inp.ref == null - then throw ''ref must be in either "refs/heads/branch-name" or "refs/tags/tag-name" format'' + then + throw '' + invalid git ref: ${inp.ref or null} + ref must be in either "refs/heads/branch-name" or "refs/tags/tag-name" format + '' else let b = builtins; diff --git a/src/subsystems/nodejs/builders/granular/default.nix b/src/subsystems/nodejs/builders/granular/default.nix index 2fb10bee64..de4a4b21a1 100644 --- a/src/subsystems/nodejs/builders/granular/default.nix +++ b/src/subsystems/nodejs/builders/granular/default.nix @@ -225,7 +225,10 @@ lib.versions.major electronDep.version; electronHeaders = - if electronDep == null + if + (electronDep == null) + # hashes seem unavailable for electron < 4 + || ((l.toInt electronVersionMajor) <= 2) then null else pkgs."electron_${electronVersionMajor}".headers; diff --git a/src/subsystems/nodejs/translators/package-json/default.nix b/src/subsystems/nodejs/translators/package-json/default.nix index 2e1cbfa5c2..f068be0db0 100644 --- a/src/subsystems/nodejs/translators/package-json/default.nix +++ b/src/subsystems/nodejs/translators/package-json/default.nix @@ -45,7 +45,7 @@ newSource=$(pwd) cd ./$relPath - rm -rf package-lock.json + rm -rf package-lock.json yarn.lock hasInstallScript=false if [ "$(jq 'has("scripts")' -c -r package.json)" == "false" ]; then diff --git a/src/subsystems/nodejs/translators/package-lock/default.nix b/src/subsystems/nodejs/translators/package-lock/default.nix index 7a3cac5d8a..e420f71974 100644 --- a/src/subsystems/nodejs/translators/package-lock/default.nix +++ b/src/subsystems/nodejs/translators/package-lock/default.nix @@ -216,7 +216,12 @@ getSourceType = dependencyObject: if identifyGitSource dependencyObject then "git" - else if lib.hasPrefix "file:" dependencyObject.version + else if + (lib.hasPrefix "file:" dependencyObject.version) + || ( + (! lib.hasPrefix "https://" dependencyObject.version) + && (! dependencyObject ? resolved) + ) then "path" else "http"; @@ -245,11 +250,23 @@ }; path = dependencyObject: - dlib.construct.pathSource { - path = getPath dependencyObject; - rootName = project.name; - rootVersion = packageVersion; - }; + # in case of an entry with missing resolved field + if ! lib.hasPrefix "file:" dependencyObject.version + then + dlib.construct.pathSource { + path = let + module = l.elemAt (l.splitString "/" dependencyObject.pname) 0; + in "node_modules/${module}"; + rootName = project.name; + rootVersion = packageVersion; + } + # in case of a "file:" entry + else + dlib.construct.pathSource { + path = getPath dependencyObject; + rootName = project.name; + rootVersion = packageVersion; + }; }; getDependencies = dependencyObject: