nodePackages: Regenerate node packages for nodejs 10 & 12

This commit is contained in:
adisbladis 2019-07-05 11:01:52 +01:00 committed by Robin Gloster
parent 443b0f6332
commit fae732edb1
No known key found for this signature in database
GPG Key ID: D5C458DF6DD97EDF
9 changed files with 8692 additions and 5228 deletions

View File

@ -1,4 +1,4 @@
# This file has been generated by node2nix 1.7.0. Do not edit!
# This file has been generated by node2nix 1.6.0. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;

View File

@ -1,8 +1,8 @@
# This file has been generated by node2nix 1.7.0. Do not edit!
# This file has been generated by node2nix 1.6.0. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-12_x"}:
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-6_x"}:
let
nodeEnv = import ./node-env.nix {

View File

@ -7,15 +7,6 @@ let
};
in
nodePackages // {
aws-azure-login = nodePackages.aws-azure-login.override {
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = "true";
buildInputs = [ pkgs.makeWrapper ];
postInstall = ''
wrapProgram "$out/bin/aws-azure-login" --set PUPPETEER_EXECUTABLE_PATH "${pkgs.chromium}/bin/chromium"
'';
};
bower2nix = nodePackages.bower2nix.override {
buildInputs = [ pkgs.makeWrapper ];
postInstall = ''

View File

@ -4,6 +4,5 @@
set -eu -o pipefail
rm -f node-env.nix
node2nix -8 -i node-packages-v8.json -o node-packages-v8.nix -c composition-v8.nix
node2nix --nodejs-10 -i node-packages-v10.json -o node-packages-v10.nix -c composition-v10.nix
node2nix --nodejs-12 -i node-packages-v12.json -o node-packages-v12.nix -c composition-v12.nix

View File

@ -11,7 +11,7 @@ let
cat > $out/bin/tar <<EOF
#! ${stdenv.shell} -e
$(type -p tar) "\$@" --warning=no-unknown-keyword --delay-directory-restore
$(type -p tar) "\$@" --warning=no-unknown-keyword
EOF
chmod +x $out/bin/tar
@ -72,7 +72,7 @@ let
packageDir="$(find . -maxdepth 1 -type d | tail -1)"
# Restore write permissions to make building work
find "$packageDir" -type d -exec chmod u+x {} \;
find "$packageDir" -type d -print0 | xargs -0 chmod u+x
chmod -R u+w "$packageDir"
# Move the extracted tarball into the output folder
@ -219,16 +219,7 @@ let
packageObj["_integrity"] = "sha1-000000000000000000000000000="; // When no _integrity string has been provided (e.g. by Git dependencies), add a dummy one. It does not seem to harm and it bypasses downloads.
}
if(dependency.resolved) {
packageObj["_resolved"] = dependency.resolved; // Adopt the resolved property if one has been provided
} else {
packageObj["_resolved"] = dependency.version; // Set the resolved version to the version identifier. This prevents NPM from cloning Git repositories.
}
if(dependency.from !== undefined) { // Adopt from property if one has been provided
packageObj["_from"] = dependency.from;
}
fs.writeFileSync(packageJSONPath, JSON.stringify(packageObj, null, 2));
}
@ -317,11 +308,50 @@ let
'';
};
prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}:
# Builds and composes an NPM package including all its dependencies
buildNodePackage =
{ name
, packageName
, version
, dependencies ? []
, buildInputs ? []
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
, bypassCache ? false
, preRebuild ? ""
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
let
forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com";
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ];
in
''
stdenv.mkDerivation ({
name = "node-${name}-${version}";
buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isLinux) utillinux
++ stdenv.lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall preRebuild unpackPhase buildPhase;
compositionScript = composePackage args;
pinpointDependenciesScript = pinpointDependenciesOfPackage args;
passAsFile = [ "compositionScript" "pinpointDependenciesScript" ];
installPhase = ''
# Create and enter a root node_modules/ folder
mkdir -p $out/lib/node_modules
cd $out/lib/node_modules
# Compose the package and all its dependencies
source $compositionScriptPath
# Pinpoint the versions of all dependencies to the ones that are actually being used
echo "pinpointing versions of dependencies..."
source $pinpointDependenciesScriptPath
@ -345,18 +375,11 @@ let
runHook preRebuild
${stdenv.lib.optionalString bypassCache ''
${stdenv.lib.optionalString reconstructLock ''
if [ -f package-lock.json ]
if [ ! -f package-lock.json ]
then
echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!"
echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!"
rm package-lock.json
else
echo "No package-lock.json file found, reconstructing..."
fi
node ${reconstructPackageLock}
''}
fi
node ${addIntegrityFieldsScript}
''}
@ -370,53 +393,6 @@ let
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install
fi
'';
# Builds and composes an NPM package including all its dependencies
buildNodePackage =
{ name
, packageName
, version
, dependencies ? []
, buildInputs ? []
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
, bypassCache ? false
, reconstructLock ? false
, preRebuild ? ""
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ];
in
stdenv.mkDerivation ({
name = "node_${name}-${version}";
buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isLinux) utillinux
++ stdenv.lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall preRebuild unpackPhase buildPhase;
compositionScript = composePackage args;
pinpointDependenciesScript = pinpointDependenciesOfPackage args;
passAsFile = [ "compositionScript" "pinpointDependenciesScript" ];
installPhase = ''
# Create and enter a root node_modules/ folder
mkdir -p $out/lib/node_modules
cd $out/lib/node_modules
# Compose the package and all its dependencies
source $compositionScriptPath
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
# Create symlink to the deployed executable folder, if applicable
if [ -d "$out/lib/node_modules/.bin" ]
@ -455,13 +431,14 @@ let
, npmFlags ? ""
, dontNpmInstall ? false
, bypassCache ? false
, reconstructLock ? false
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
let
forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com";
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ];
nodeDependencies = stdenv.mkDerivation ({
@ -496,13 +473,39 @@ let
fi
''}
# Go to the parent folder to make sure that all packages are pinpointed
# Pinpoint the versions of all dependencies to the ones that are actually being used
echo "pinpointing versions of dependencies..."
cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
source $pinpointDependenciesScriptPath
cd ${packageName}
# Patch the shebangs of the bundled modules to prevent them from
# calling executables outside the Nix store as much as possible
patchShebangs .
export HOME=$PWD
${stdenv.lib.optionalString bypassCache ''
if [ ! -f package-lock.json ]
then
echo "No package-lock.json file found, reconstructing..."
node ${reconstructPackageLock}
fi
node ${addIntegrityFieldsScript}
''}
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild
${stdenv.lib.optionalString (!dontNpmInstall) ''
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
rm -f npm-shrinkwrap.json
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install
''}
# Expose the executables that were installed
cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
@ -529,7 +532,6 @@ let
inherit nodeDependencies;
shellHook = stdenv.lib.optionalString (dependencies != []) ''
export NODE_PATH=$nodeDependencies/lib/node_modules
export PATH="$nodeDependencies/bin:$PATH"
'';
};
in

View File

@ -2,8 +2,15 @@
"@angular/cli"
, "@antora/cli"
, "@antora/site-generator-default"
, "@vue/cli"
, "@webassemblyjs/cli"
, "@webassemblyjs/repl"
, "@webassemblyjs/wasm-strip"
, "@webassemblyjs/wasm-text-gen"
, "@webassemblyjs/wast-refmt"
, "alloy"
, "asar"
, "aws-azure-login"
, "azure-cli"
, "azure-functions-core-tools"
, "bash-language-server"
, "bower"
@ -27,9 +34,9 @@
, "elm-live"
, "elm-oracle"
, "emoj"
, "emojione"
, "eslint"
, "eslint_d"
, "emojione"
, {"fast-cli": "1.x"}
, "fkill-cli"
, "forever"
@ -40,26 +47,26 @@
, "grunt-cli"
, "gulp"
, "gulp-cli"
, "htmlhint"
, "html-minifier"
, "htmlhint"
, "http-server"
, "hueadm"
, "ionic"
, "ios-deploy"
, "imapnotify"
, "indium"
, "ionic"
, "ios-deploy"
, "jake"
, "javascript-typescript-langserver"
, "joplin"
, "js-beautify"
, "js-yaml"
, "jsdoc"
, "jshint"
, "json"
, "js-beautify"
, "jsonlint"
, "json-diff"
, "json-refs"
, "json-server"
, "js-yaml"
, "jsonlint"
, "karma"
, "lcov-result-merger"
, "leetcode-cli"
@ -78,24 +85,25 @@
, "multi-file-swagger"
, "neovim"
, "nijs"
, "node2nix"
, "node-gyp"
, "node-gyp-build"
, "node-inspector"
, "node-pre-gyp"
, "nodemon"
, "node-red"
, "node2nix"
, "nodemon"
, "npm"
, "npm-check-updates"
, {"npm2nix": "git://github.com/NixOS/npm2nix.git#5.12.0"}
, "ocaml-language-server"
, "parcel-bundler"
, "peerflix"
, "peerflix-server"
, "pnpm"
, "parcel-bundler"
, "prettier"
, "pulp"
, "react-tools"
, "react-native-cli"
, "react-tools"
, "reveal.js"
, "s3http"
, "semver"
@ -108,6 +116,7 @@
, "speed-test"
, "ssb-server"
, "stackdriver-statsd-backend"
, "stf"
, "svgo"
, "swagger"
, {"tedicross": "git+https://github.com/TediCross/TediCross.git#v0.8.7"}
@ -129,6 +138,7 @@
, "thelounge"
, "three"
, "tiddlywiki"
, "titanium"
, "triton"
, "tsun"
, "ttf2eot"
@ -139,17 +149,11 @@
, "vscode-css-languageserver-bin"
, "vscode-html-languageserver-bin"
, "vue-cli"
, "@vue/cli"
, "vue-language-server"
, "@webassemblyjs/cli"
, "@webassemblyjs/repl"
, "@webassemblyjs/wasm-strip"
, "@webassemblyjs/wasm-text-gen"
, "@webassemblyjs/wast-refmt"
, "web-ext"
, "webpack"
, "webpack-cli"
, "webtorrent-cli"
, "web-ext"
, "wring"
, "write-good"
, "yarn"

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
# This file has been generated by node2nix 1.7.0. Do not edit!
# This file has been generated by node2nix 1.6.0. Do not edit!
{nodeEnv, fetchurl, fetchgit, globalBuildInputs ? []}:
@ -1624,13 +1624,13 @@ let
sha1 = "212d5bfe1318306a420f6402b8e26ff39647a849";
};
};
"psl-1.2.0" = {
"psl-1.3.0" = {
name = "psl";
packageName = "psl";
version = "1.2.0";
version = "1.3.0";
src = fetchurl {
url = "https://registry.npmjs.org/psl/-/psl-1.2.0.tgz";
sha512 = "GEn74ZffufCmkDDLNcl3uuyF/aSD6exEyh1v/ZSdAomB82t6G9hzJVRx0jBmLDW+VfZqks3aScmMw9DszwUalA==";
url = "https://registry.npmjs.org/psl/-/psl-1.3.0.tgz";
sha512 = "avHdspHO+9rQTLbv1RO+MPYeP/SzsCoxofjVnHanETfQhTJrmB0HlDoW+EiN/R+C0BZ+gERab9NY0lPN2TxNag==";
};
};
"punycode-1.4.1" = {
@ -1714,13 +1714,13 @@ let
sha512 = "NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==";
};
};
"resolve-1.11.1" = {
"resolve-1.12.0" = {
name = "resolve";
packageName = "resolve";
version = "1.11.1";
version = "1.12.0";
src = fetchurl {
url = "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz";
sha512 = "vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==";
url = "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz";
sha512 = "B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==";
};
};
"resolve-dir-1.0.1" = {
@ -2303,8 +2303,7 @@ in
license = "MIT";
};
production = true;
bypassCache = true;
reconstructLock = true;
bypassCache = false;
};
coffee-script = nodeEnv.buildNodePackage {
name = "coffee-script";
@ -2321,8 +2320,7 @@ in
license = "MIT";
};
production = true;
bypassCache = true;
reconstructLock = true;
bypassCache = false;
};
grunt-cli = nodeEnv.buildNodePackage {
name = "grunt-cli";
@ -2497,7 +2495,7 @@ in
sources."regex-not-1.0.2"
sources."repeat-element-1.1.3"
sources."repeat-string-1.6.1"
sources."resolve-1.11.1"
sources."resolve-1.12.0"
sources."resolve-dir-1.0.1"
sources."resolve-url-0.2.1"
sources."ret-0.1.15"
@ -2587,8 +2585,7 @@ in
license = "MIT";
};
production = true;
bypassCache = true;
reconstructLock = true;
bypassCache = false;
};
node2nix = nodeEnv.buildNodePackage {
name = "node2nix";
@ -2716,7 +2713,7 @@ in
sources."performance-now-2.1.0"
sources."process-nextick-args-2.0.1"
sources."proto-list-1.2.4"
sources."psl-1.2.0"
sources."psl-1.3.0"
sources."punycode-2.1.1"
sources."qs-6.5.2"
(sources."readable-stream-2.3.6" // {
@ -2725,7 +2722,7 @@ in
];
})
sources."request-2.88.0"
sources."resolve-1.11.1"
sources."resolve-1.12.0"
sources."retry-0.10.1"
sources."rimraf-2.6.3"
sources."safe-buffer-5.2.0"
@ -2777,7 +2774,6 @@ in
license = "MIT";
};
production = true;
bypassCache = true;
reconstructLock = true;
bypassCache = false;
};
}

View File

@ -653,7 +653,7 @@ in
iamy = callPackage ../tools/admin/iamy { };
azure-cli = nodePackages_8_x.azure-cli;
azure-cli = nodePackages_10_x.azure-cli;
azure-storage-azcopy = callPackage ../development/tools/azcopy { };