node2nix: 1.6.0 -> 1.7.0 and regenerate all Nix expressions, introduce nodePackages_12_x attribute set

This commit is contained in:
Sander van der Burg
2019-06-05 23:48:42 +02:00
parent a6549852e8
commit 18c2b52314
25 changed files with 2819 additions and 3207 deletions

View File

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

View File

@@ -0,0 +1,17 @@
# This file has been generated by node2nix 1.7.0. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-12_x"}:
let
nodeEnv = import ./node-env.nix {
inherit (pkgs) stdenv python2 utillinux runCommand writeTextFile;
inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
};
in
import ./node-packages-v12.nix {
inherit (pkgs) fetchurl fetchgit;
inherit nodeEnv;
}

View File

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

View File

@@ -0,0 +1,16 @@
{ pkgs, nodejs, stdenv }:
let
nodePackages = import ./composition-v12.nix {
inherit pkgs nodejs;
inherit (stdenv.hostPlatform) system;
};
in
nodePackages // {
node2nix = nodePackages.node2nix.override {
buildInputs = [ pkgs.makeWrapper ];
postInstall = ''
wrapProgram "$out/bin/node2nix" --prefix PATH : ${stdenv.lib.makeBinPath [ pkgs.nix ]}
'';
};
}

View File

@@ -1,23 +0,0 @@
{ pkgs, nodejs, stdenv }:
let
nodePackages = import ./composition-v6.nix {
inherit pkgs nodejs;
inherit (stdenv.hostPlatform) system;
};
in
nodePackages // {
pnpm = nodePackages.pnpm.override {
nativeBuildInputs = [ pkgs.makeWrapper ];
postInstall = let
pnpmLibPath = stdenv.lib.makeBinPath [
nodejs.passthru.python
nodejs
];
in ''
for prog in $out/bin/*; do
wrapProgram "$prog" --prefix PATH : ${pnpmLibPath}
done
'';
};
}

View File

@@ -6,3 +6,4 @@ 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
$(type -p tar) "\$@" --warning=no-unknown-keyword --delay-directory-restore
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 -print0 | xargs -0 chmod u+x
find "$packageDir" -type d -exec chmod u+x {} \;
chmod -R u+w "$packageDir"
# Move the extracted tarball into the output folder
@@ -219,7 +219,16 @@ 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.
}
packageObj["_resolved"] = dependency.version; // Set the resolved version to the version identifier. This prevents NPM from cloning Git repositories.
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));
}
@@ -308,50 +317,11 @@ let
'';
};
# 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:
prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}:
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
@@ -375,11 +345,18 @@ let
runHook preRebuild
${stdenv.lib.optionalString bypassCache ''
if [ ! -f package-lock.json ]
then
echo "No package-lock.json file found, reconstructing..."
node ${reconstructPackageLock}
fi
${stdenv.lib.optionalString reconstructLock ''
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}
''}
node ${addIntegrityFieldsScript}
''}
@@ -393,6 +370,53 @@ 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" ]
@@ -431,14 +455,13 @@ 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 ({
@@ -473,39 +496,13 @@ let
fi
''}
# Pinpoint the versions of all dependencies to the ones that are actually being used
echo "pinpointing versions of dependencies..."
# Go to the parent folder to make sure that all packages are pinpointed
cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
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
''}
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
# Expose the executables that were installed
cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
@@ -532,6 +529,7 @@ let
inherit nodeDependencies;
shellHook = stdenv.lib.optionalString (dependencies != []) ''
export NODE_PATH=$nodeDependencies/lib/node_modules
export PATH="$nodeDependencies/bin:$PATH"
'';
};
in

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
[
"nijs"
, "coffee-script"
, "grunt-cli"
, "node2nix"
]

View File

@@ -1,9 +0,0 @@
[
"bower"
, "coffee-script"
, "grunt-cli"
, "node-gyp"
, "node-gyp-build"
, "node-pre-gyp"
, "pnpm"
]

View File

@@ -1,4 +1,4 @@
# This file has been generated by node2nix 1.6.0. Do not edit!
# This file has been generated by node2nix 1.7.0. Do not edit!
{nodeEnv, fetchurl, fetchgit, globalBuildInputs ? []}:
@@ -40,13 +40,13 @@ let
sha512 = "xH2e58elpj1X4ynnKp9qSnWlsRTIs6n3tgLGNfwAGHwePw0mulHQllV34n0T25uYSu1k0hRKkWXF890B1yS47w==";
};
};
"@types/node-8.10.48" = {
"@types/node-8.10.49" = {
name = "_at_types_slash_node";
packageName = "@types/node";
version = "8.10.48";
version = "8.10.49";
src = fetchurl {
url = "https://registry.npmjs.org/@types/node/-/node-8.10.48.tgz";
sha512 = "c35YEBTkL4rzXY2ucpSKy+UYHjUBIIkuJbWYbsGIrKLEWU5dgJMmLkkIb3qeC3O3Tpb1ZQCwecscvJTDjDjkRw==";
url = "https://registry.npmjs.org/@types/node/-/node-8.10.49.tgz";
sha512 = "YX30JVx0PvSmJ3Eqr74fYLGeBxD+C7vIL20ek+GGGLJeUbVYRUW3EzyAXpIRA0K8c8o0UWqR/GwEFYiFoz1T8w==";
};
};
"JSV-4.0.2" = {
@@ -553,13 +553,13 @@ let
sha512 = "Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==";
};
};
"aws-sdk-2.464.0" = {
"aws-sdk-2.469.0" = {
name = "aws-sdk";
packageName = "aws-sdk";
version = "2.464.0";
version = "2.469.0";
src = fetchurl {
url = "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.464.0.tgz";
sha512 = "DsJ/V/Eaazio5klO49IXIgnDpBcObgOunFs0KsUbdPz5yxvznZQiez9LqTcaj0SaCS7zsrT9K5p+Jtbt60z1SA==";
url = "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.469.0.tgz";
sha512 = "VaIrO3aBX83gKkBPk9xM0RHmu7fmq76kaF0SqbsWlPImgxc5foJ4rBlRMMlmeNogFZZ/XTQdI+gkFDVosV14Ig==";
};
};
"aws-sign2-0.6.0" = {
@@ -6061,13 +6061,13 @@ let
sha1 = "925d2601d39ac485e091cf0da5c6e694dc3dcaff";
};
};
"resolve-1.11.0" = {
"resolve-1.11.1" = {
name = "resolve";
packageName = "resolve";
version = "1.11.0";
version = "1.11.1";
src = fetchurl {
url = "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz";
sha512 = "WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==";
url = "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz";
sha512 = "vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==";
};
};
"resolve-dir-1.0.1" = {
@@ -6970,13 +6970,13 @@ let
sha1 = "8030046939b00096e625c0dd6b3905bc7b85709c";
};
};
"tar-4.4.8" = {
"tar-4.4.10" = {
name = "tar";
packageName = "tar";
version = "4.4.8";
version = "4.4.10";
src = fetchurl {
url = "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz";
sha512 = "LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==";
url = "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz";
sha512 = "g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA==";
};
};
"temp-0.8.3" = {
@@ -8102,7 +8102,7 @@ in
sources."private-0.1.8"
sources."regenerator-runtime-0.11.1"
sources."repeating-2.0.1"
sources."resolve-1.11.0"
sources."resolve-1.11.1"
sources."safe-buffer-5.1.2"
sources."sax-0.5.8"
sources."slash-1.0.0"
@@ -8132,6 +8132,7 @@ in
};
production = true;
bypassCache = true;
reconstructLock = true;
};
azure-cli = nodeEnv.buildNodePackage {
name = "azure-cli";
@@ -8142,7 +8143,7 @@ in
sha512 = "MMiK5sFfIocNMWCc5PshUCAe6aY4P13/GCmSwudOziA/pFdQMHU8jhu+jU2SSWFug4K1ugeuCwtMXe43oL0PhQ==";
};
dependencies = [
sources."@types/node-8.10.48"
sources."@types/node-8.10.49"
sources."JSV-4.0.2"
sources."adal-node-0.1.28"
sources."ajv-6.10.0"
@@ -8535,6 +8536,7 @@ in
};
production = true;
bypassCache = true;
reconstructLock = true;
};
bower = nodeEnv.buildNodePackage {
name = "bower";
@@ -8552,6 +8554,7 @@ in
};
production = true;
bypassCache = true;
reconstructLock = true;
};
coffee-script = nodeEnv.buildNodePackage {
name = "coffee-script";
@@ -8569,6 +8572,7 @@ in
};
production = true;
bypassCache = true;
reconstructLock = true;
};
grunt-cli = nodeEnv.buildNodePackage {
name = "grunt-cli";
@@ -8743,7 +8747,7 @@ in
sources."regex-not-1.0.2"
sources."repeat-element-1.1.3"
sources."repeat-string-1.6.1"
sources."resolve-1.11.0"
sources."resolve-1.11.1"
sources."resolve-dir-1.0.1"
sources."resolve-url-0.2.1"
sources."ret-0.1.15"
@@ -8839,6 +8843,7 @@ in
};
production = true;
bypassCache = true;
reconstructLock = true;
};
node-gyp = nodeEnv.buildNodePackage {
name = "node-gyp";
@@ -8935,7 +8940,7 @@ in
sources."string-width-1.0.2"
sources."string_decoder-1.1.1"
sources."strip-ansi-3.0.1"
sources."tar-4.4.8"
sources."tar-4.4.10"
(sources."tough-cookie-2.4.3" // {
dependencies = [
sources."punycode-1.4.1"
@@ -8960,6 +8965,7 @@ in
};
production = true;
bypassCache = true;
reconstructLock = true;
};
node-gyp-build = nodeEnv.buildNodePackage {
name = "node-gyp-build";
@@ -8977,6 +8983,7 @@ in
};
production = true;
bypassCache = true;
reconstructLock = true;
};
node-pre-gyp = nodeEnv.buildNodePackage {
name = "node-pre-gyp";
@@ -9050,7 +9057,7 @@ in
sources."string_decoder-1.1.1"
sources."strip-ansi-3.0.1"
sources."strip-json-comments-2.0.1"
sources."tar-4.4.8"
sources."tar-4.4.10"
sources."util-deprecate-1.0.2"
sources."wide-align-1.1.3"
sources."wrappy-1.0.2"
@@ -9064,6 +9071,7 @@ in
};
production = true;
bypassCache = true;
reconstructLock = true;
};
pnpm = nodeEnv.buildNodePackage {
name = "pnpm";
@@ -9081,6 +9089,7 @@ in
};
production = true;
bypassCache = true;
reconstructLock = true;
};
stf = nodeEnv.buildNodePackage {
name = "stf";
@@ -9150,7 +9159,7 @@ in
sources."async-1.5.2"
sources."async-limiter-1.0.0"
sources."asynckit-0.4.0"
sources."aws-sdk-2.464.0"
sources."aws-sdk-2.469.0"
sources."aws-sign2-0.6.0"
sources."aws4-1.8.0"
sources."babel-runtime-6.26.0"
@@ -9629,7 +9638,7 @@ in
sources."require-directory-2.1.1"
sources."require-main-filename-1.0.1"
sources."requires-port-1.0.0"
sources."resolve-1.11.0"
sources."resolve-1.11.1"
sources."ret-0.2.2"
sources."rethinkdb-2.3.3"
sources."retry-0.9.0"
@@ -9897,6 +9906,7 @@ in
};
production = true;
bypassCache = true;
reconstructLock = true;
};
titanium = nodeEnv.buildNodePackage {
name = "titanium";
@@ -10030,5 +10040,6 @@ in
};
production = true;
bypassCache = true;
reconstructLock = true;
};
}