From 2312f5fbc4a5031450f575a860a6c38dd35a47e9 Mon Sep 17 00:00:00 2001 From: Christian Albrecht Date: Fri, 29 May 2020 18:25:11 +0200 Subject: [PATCH] Change to nodePackages and nodePackages_latest currently LTS 12.x and Current 14.x --- doc/languages-frameworks/node.section.md | 19 +++++++++---------- pkgs/top-level/all-packages.nix | 12 +++++------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/doc/languages-frameworks/node.section.md b/doc/languages-frameworks/node.section.md index d7f184fca23..c1f4294711a 100644 --- a/doc/languages-frameworks/node.section.md +++ b/doc/languages-frameworks/node.section.md @@ -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-v12.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-v12.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.`. - To build against a specific Node.js version (e.g. 12.x): - `nix-build -A nodePackages_12_x.` + To build against the latest stable Current Node.js version (e.g. 14.x): + `nix-build -A nodePackages_latest.` 4. Add and commit all modified and generated files. For more information about the generation process, consult the diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 046acf92954..3fe54d5b898 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4827,7 +4827,7 @@ in 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 { }; @@ -4851,16 +4851,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 = nodePackages_12_x; - now-cli = callPackage ../development/web/now-cli {}; file-rename = callPackage ../tools/filesystems/file-rename { };