Merge pull request #89184 from mayflower/continue-pull-85764

This commit is contained in:
Jörg Thalheim 2020-05-30 11:36:56 +01:00 committed by GitHub
commit 87908c3743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 4582 additions and 8877 deletions

View File

@ -12,10 +12,9 @@ When it is desired to use NPM libraries in a development project, use the
`node2nix` generator directly on the `package.json` configuration file of the
project.
The package set also provides support for multiple Node.js versions. The policy
is that a new package should be added to the collection for the latest stable LTS
release (which is currently 10.x), unless there is an explicit reason to support
a different release.
The package set provides support for the official stable Node.js versions.
The latest stable LTS release in `nodePackages`, as well as the latest stable
Current release in `nodePackages_latest`.
If your package uses native addons, you need to examine what kind of native
build system it uses. Here are some examples:
@ -26,7 +25,7 @@ build system it uses. Here are some examples:
After you have identified the correct system, you need to override your package
expression while adding in build system as a build input. For example, `dat`
requires `node-gyp-build`, so we override its expression in `default-v10.nix`:
requires `node-gyp-build`, so we override its expression in `default.nix`:
```nix
dat = nodePackages.dat.override (oldAttrs: {
@ -36,14 +35,14 @@ dat = nodePackages.dat.override (oldAttrs: {
To add a package from NPM to nixpkgs:
1. Modify `pkgs/development/node-packages/node-packages-v10.json` to add, update
or remove package entries. (Or `pkgs/development/node-packages/node-packages-v8.json`
for packages depending on Node.js 8.x)
1. Modify `pkgs/development/node-packages/node-packages.json` to add, update
or remove package entries to have it included in `nodePackages` and
`nodePackages_latest`.
2. Run the script: `(cd pkgs/development/node-packages && ./generate.sh)`.
3. Build your new package to test your changes:
`cd /path/to/nixpkgs && nix-build -A nodePackages.<new-or-updated-package>`.
To build against a specific Node.js version (e.g. 10.x):
`nix-build -A nodePackages_10_x.<new-or-updated-package>`
To build against the latest stable Current Node.js version (e.g. 14.x):
`nix-build -A nodePackages_latest.<new-or-updated-package>`
4. Add and commit all modified and generated files.
For more information about the generation process, consult the

View File

@ -13,7 +13,7 @@ rec {
buildApp = import ./build-app.nix {
inherit (pkgs) stdenv python which file jdk nodejs;
inherit (pkgs.nodePackages_10_x) alloy titanium;
inherit (pkgs.nodePackages) alloy titanium;
inherit (androidenv) composeAndroidPackages;
inherit (xcodeenv) composeXcodeWrapper;
inherit titaniumsdk;

View File

@ -1,17 +0,0 @@
# This file has been generated by node2nix 1.8.0. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-10_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-v10.nix {
inherit (pkgs) fetchurl fetchgit;
inherit nodeEnv;
}

View File

@ -1,17 +0,0 @@
# This file has been generated by node2nix 1.8.0. Do not edit!
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-13_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-v13.nix {
inherit (pkgs) fetchurl fetchgit;
inherit nodeEnv;
}

View File

@ -11,7 +11,7 @@ let
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
};
in
import ./node-packages-v12.nix {
import ./node-packages.nix {
inherit (pkgs) fetchurl fetchgit;
inherit nodeEnv;
}

View File

@ -1,16 +0,0 @@
{ 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,16 +0,0 @@
{ pkgs, nodejs, stdenv }:
let
nodePackages = import ./composition-v13.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,7 +1,9 @@
{ pkgs, nodejs, stdenv }:
let
nodePackages = import ./composition-v10.nix {
since = (version: pkgs.lib.versionAtLeast nodejs.version version);
before = (version: pkgs.lib.versionOlder nodejs.version version);
nodePackages = import ./composition.nix {
inherit pkgs nodejs;
inherit (stdenv.hostPlatform) system;
};
@ -21,12 +23,21 @@ nodePackages // {
'';
};
coc-imselect = nodePackages.coc-imselect.override {
meta.broken = since "10";
};
"fast-cli-1.x" = nodePackages."fast-cli-1.x".override {
meta.broken = since "10";
};
jshint = nodePackages.jshint.override {
buildInputs = [ pkgs.phantomjs2 ];
};
dat = nodePackages.dat.override {
buildInputs = [ nodePackages.node-gyp-build pkgs.libtool pkgs.autoconf pkgs.automake ];
meta.broken = since "12";
};
dnschain = nodePackages.dnschain.override {
@ -34,6 +45,7 @@ nodePackages // {
postInstall = ''
wrapProgram $out/bin/dnschain --suffix PATH : ${pkgs.openssl.bin}/bin
'';
meta.broken = since "14";
};
bitwarden-cli = pkgs.lib.overrideDerivation nodePackages."@bitwarden/cli" (drv: {
@ -48,6 +60,7 @@ nodePackages // {
ln -s /usr/bin/xcodebuild $tmp
export PATH="$PATH:$tmp"
'';
meta.platforms = [ pkgs.lib.platforms.darwin ];
});
fast-cli = nodePackages."fast-cli-1.x".override {
@ -60,14 +73,17 @@ nodePackages // {
git-ssb = nodePackages.git-ssb.override {
buildInputs = [ nodePackages.node-gyp-build ];
meta.broken = since "10";
};
insect = nodePackages.insect.override (drv: {
nativeBuildInputs = drv.nativeBuildInputs or [] ++ [ pkgs.psc-package pkgs.purescript nodePackages.pulp ];
meta.broken = since "10";
});
node-inspector = nodePackages.node-inspector.override {
buildInputs = [ nodePackages.node-pre-gyp ];
meta.broken = since "10";
};
node2nix = nodePackages.node2nix.override {
@ -77,6 +93,10 @@ nodePackages // {
'';
};
node-red = nodePackages.node-red.override {
meta.broken = since "10";
};
pnpm = nodePackages.pnpm.override {
nativeBuildInputs = [ pkgs.makeWrapper ];
@ -96,8 +116,13 @@ nodePackages // {
'';
};
pulp = nodePackages.pulp.override {
meta.broken = since "10";
};
ssb-server = nodePackages.ssb-server.override {
buildInputs = [ pkgs.automake pkgs.autoconf nodePackages.node-gyp-build ];
meta.broken = since "10";
};
tedicross = nodePackages."tedicross-git+https://github.com/TediCross/TediCross.git#v0.8.7".override {
@ -108,6 +133,10 @@ nodePackages // {
'';
};
stf = nodePackages.stf.override {
meta.broken = since "10";
};
webtorrent-cli = nodePackages.webtorrent-cli.override {
buildInputs = [ nodePackages.node-gyp-build ];
};
@ -125,8 +154,5 @@ nodePackages // {
thelounge = nodePackages.thelounge.override {
buildInputs = [ nodePackages.node-pre-gyp ];
postInstall = ''
echo /var/lib/thelounge > $out/lib/node_modules/thelounge/.thelounge_home
'';
};
}

View File

@ -6,6 +6,4 @@ node2nix=$(nix-build ../../.. --no-out-link -A nodePackages.node2nix)
cd ${DIR}
rm -f ./node-env.nix
for version in 10 12 13; do
"${node2nix}/bin/node2nix" --nodejs-$version -i node-packages-v$version.json -o node-packages-v$version.nix -c composition-v$version.nix
done
${node2nix}/bin/node2nix -i node-packages.json -o node-packages.nix -c composition.nix

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
[
"node2nix"
]

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,14 @@
{ stdenv, nodePackages_10_x }:
{ stdenv, nodePackages }:
let
linkNodeDeps = ({ pkg, deps, name ? "" }:
let
targetModule = if name != "" then name else stdenv.lib.getName pkg;
in nodePackages_10_x.${pkg}.override (oldAttrs: {
in nodePackages.${pkg}.override (oldAttrs: {
postInstall = ''
mkdir -p $out/lib/node_modules/${targetModule}/node_modules
${stdenv.lib.concatStringsSep "\n" (map (dep: ''
ln -s ${nodePackages_10_x.${dep}}/lib/node_modules/${stdenv.lib.getName dep} \
ln -s ${nodePackages.${dep}}/lib/node_modules/${stdenv.lib.getName dep} \
$out/lib/node_modules/${targetModule}/node_modules/${stdenv.lib.getName dep}
'') deps
)}

View File

@ -1,5 +1,5 @@
# Update script: pkgs/development/tools/rust/rust-analyzer/update.sh
{ lib, stdenv, vscode-utils, jq, rust-analyzer, nodePackages_10_x
{ lib, stdenv, vscode-utils, jq, rust-analyzer, nodePackages
, setDefaultServerPath ? true
}:
@ -10,7 +10,7 @@ let
# Follow the unstable version of rust-analyzer, since the extension is not stable yet.
inherit (rust-analyzer) version;
build-deps = nodePackages_10_x."rust-analyzer-build-deps-../../misc/vscode-extensions/rust-analyzer/build-deps";
build-deps = nodePackages."rust-analyzer-build-deps-../../misc/vscode-extensions/rust-analyzer/build-deps";
# FIXME: Making a new derivation to link `node_modules` and run `npm run package`
# will cause a build failure.
vsix = build-deps.override {

View File

@ -4829,9 +4829,9 @@ in
nixnote2 = libsForQt5.callPackage ../applications/misc/nixnote2 { };
nodejs = hiPrio nodejs-10_x;
nodejs = hiPrio nodejs-12_x;
nodejs-slim = nodejs-slim-10_x;
nodejs-slim = nodejs-slim-12_x;
nodejs-10_x = callPackage ../development/web/nodejs/v10.nix { };
@ -4855,20 +4855,14 @@ in
nodejs_latest = nodejs-14_x;
nodejs-slim_latest = nodejs-slim-14_x;
nodePackages_13_x = dontRecurseIntoAttrs (callPackage ../development/node-packages/default-v13.nix {
nodejs = pkgs.nodejs-13_x;
nodePackages_latest = dontRecurseIntoAttrs (callPackage ../development/node-packages/default.nix {
nodejs = pkgs.nodejs_latest;
});
nodePackages_12_x = dontRecurseIntoAttrs (callPackage ../development/node-packages/default-v12.nix {
nodejs = pkgs.nodejs-12_x;
nodePackages = dontRecurseIntoAttrs (callPackage ../development/node-packages/default.nix {
nodejs = pkgs.nodejs;
});
nodePackages_10_x = dontRecurseIntoAttrs (callPackage ../development/node-packages/default-v10.nix {
nodejs = pkgs.nodejs-10_x;
});
nodePackages = nodePackages_10_x;
now-cli = callPackage ../development/web/now-cli {};
file-rename = callPackage ../tools/filesystems/file-rename { };