Skip to content

Commit

Permalink
Merge pull request #89184 from mayflower/continue-pull-85764
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 authored May 30, 2020
2 parents 19d44fc + 6149df8 commit 87908c3
Show file tree
Hide file tree
Showing 18 changed files with 4,569 additions and 8,864 deletions.
19 changes: 9 additions & 10 deletions doc/languages-frameworks/node.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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: {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/mobile/titaniumenv/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 0 additions & 17 deletions pkgs/development/node-packages/composition-v10.nix

This file was deleted.

17 changes: 0 additions & 17 deletions pkgs/development/node-packages/composition-v13.nix

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
16 changes: 0 additions & 16 deletions pkgs/development/node-packages/default-v12.nix

This file was deleted.

16 changes: 0 additions & 16 deletions pkgs/development/node-packages/default-v13.nix

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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;
};
Expand All @@ -21,19 +23,29 @@ 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 {
buildInputs = [ pkgs.makeWrapper nodePackages.coffee-script ];
postInstall = ''
wrapProgram $out/bin/dnschain --suffix PATH : ${pkgs.openssl.bin}/bin
'';
meta.broken = since "14";
};

bitwarden-cli = pkgs.lib.overrideDerivation nodePackages."@bitwarden/cli" (drv: {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -77,6 +93,10 @@ nodePackages // {
'';
};

node-red = nodePackages.node-red.override {
meta.broken = since "10";
};

pnpm = nodePackages.pnpm.override {
nativeBuildInputs = [ pkgs.makeWrapper ];

Expand All @@ -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 {
Expand All @@ -108,6 +133,10 @@ nodePackages // {
'';
};

stf = nodePackages.stf.override {
meta.broken = since "10";
};

webtorrent-cli = nodePackages.webtorrent-cli.override {
buildInputs = [ nodePackages.node-gyp-build ];
};
Expand All @@ -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
'';
};
}
4 changes: 1 addition & 3 deletions pkgs/development/node-packages/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 0 additions & 9 deletions pkgs/development/node-packages/node-packages-v12.json

This file was deleted.

Loading

0 comments on commit 87908c3

Please sign in to comment.