nodejs: add a corepack output (#487796)

This commit is contained in:
Antoine du Hamel
2026-02-07 22:38:01 +00:00
committed by GitHub
5 changed files with 39 additions and 40 deletions
+1 -1
View File
@@ -145,7 +145,7 @@
- `services.openssh.settings.AcceptEnv` now explicitly defined as an option that takes a list of strings, to facilitate option merging. Setting it to a string value is no longer supported.
- `nodejs-slim` has a `npm` output, and `nodejs` no longer has a `libv8` output.
- `nodejs-slim` has a `npm` and a `corepack` outputs, and `nodejs` no longer has a `libv8` output.
- All Xfce packages have been moved to top level (e.g. if you previously added `pkgs.xfce.xfce4-whiskermenu-plugin` to `environment.systemPackages`, you will need to change it to `pkgs.xfce4-whiskermenu-plugin`). The `xfce` scope will be removed in NixOS 26.11.
+2 -1
View File
@@ -8,7 +8,8 @@ stdenv.mkDerivation {
pname = "corepack-nodejs";
inherit (nodejs) version;
nativeBuildInputs = [ nodejs ];
nativeBuildInputs = [ nodejs.corepack ];
buildInputs = [ nodejs ];
dontUnpack = true;
+18 -6
View File
@@ -173,6 +173,8 @@ let
builtins.attrNames sharedLibDeps
);
bundlesCorepack = !lib.versionAtLeast version "25.0.0";
# Currently stdenv sets CC/LD/AR/etc environment variables to program names
# instead of absolute paths. If we add cctools to nativeBuildInputs, that
# would shadow stdenvs bintools and potentially break other parts of the
@@ -275,6 +277,7 @@ let
"libv8"
"npm"
]
++ lib.optional bundlesCorepack "corepack"
++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [ "dev" ];
setOutputFlags = false;
moveToDev = false;
@@ -353,6 +356,7 @@ let
postPatch = ''
substituteInPlace tools/install.py \
--replace-fail ' corepack_files(options, action)' " oip=options.install_path;options.install_path='$corepack';corepack_files(options, action);options.install_path=oip" \
--replace-fail ' npm_files(options, action)' " oip=options.install_path;options.install_path='$npm';npm_files(options, action);options.install_path=oip"
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
@@ -505,21 +509,29 @@ let
outputChecks = {
out = {
disallowedReferences = [
"npm"
"libv8"
"npm"
]
++ lib.optional bundlesCorepack "corepack";
};
corepack = {
disallowedReferences = [
"libv8"
"npm"
];
};
libv8 = {
disallowedReferences = [
"out"
"npm"
];
]
++ lib.optional bundlesCorepack "corepack";
};
npm = {
disallowedReferences = [
"out"
"libv8"
];
]
++ lib.optional bundlesCorepack "corepack";
};
};
@@ -560,8 +572,6 @@ let
''
+ ''
HOST_PATH=$out/bin patchShebangs --host $out
${lib.optionalString canExecute ''
$out/bin/node --completion-bash > node.bash
installShellCompletion node.bash
@@ -609,6 +619,8 @@ let
'';
postFixup = ''
HOST_PATH=$out/bin patchShebangs --host $out ${lib.optionalString bundlesCorepack "$corepack"} $npm
for dir in "$npm/lib/node_modules/npm/man/"*; do
mkdir -p $npm/share/man/$(basename "$dir")
for page in "$dir"/*; do
+14
View File
@@ -0,0 +1,14 @@
{
lib,
nodejs-slim,
symlinkJoin,
}:
symlinkJoin {
pname = "nodejs";
inherit (nodejs-slim) version passthru meta;
paths = [
nodejs-slim
nodejs-slim.npm
]
++ lib.optional (builtins.hasAttr "corepack" nodejs-slim) nodejs-slim.corepack;
}
+4 -32
View File
@@ -2859,47 +2859,19 @@ with pkgs;
nodejs-slim = nodejs-slim_24;
nodejs-slim_20 = callPackage ../development/web/nodejs/v20.nix { };
nodejs_20 = symlinkJoin {
pname = "nodejs";
inherit (nodejs-slim_20) version passthru meta;
paths = [
nodejs-slim_20
nodejs-slim_20.npm
];
};
nodejs_20 = callPackage ../development/web/nodejs/symlink.nix { nodejs-slim = nodejs-slim_20; };
corepack_20 = callPackage ../development/web/nodejs/corepack.nix { nodejs = nodejs-slim_20; };
nodejs-slim_22 = callPackage ../development/web/nodejs/v22.nix { };
nodejs_22 = symlinkJoin {
pname = "nodejs";
inherit (nodejs-slim_22) version passthru meta;
paths = [
nodejs-slim_22
nodejs-slim_22.npm
];
};
nodejs_22 = callPackage ../development/web/nodejs/symlink.nix { nodejs-slim = nodejs-slim_22; };
corepack_22 = callPackage ../development/web/nodejs/corepack.nix { nodejs = nodejs-slim_22; };
nodejs-slim_24 = callPackage ../development/web/nodejs/v24.nix { };
nodejs_24 = symlinkJoin {
pname = "nodejs";
inherit (nodejs-slim_24) version passthru meta;
paths = [
nodejs-slim_24
nodejs-slim_24.npm
];
};
nodejs_24 = callPackage ../development/web/nodejs/symlink.nix { nodejs-slim = nodejs-slim_24; };
corepack_24 = callPackage ../development/web/nodejs/corepack.nix { nodejs = nodejs-slim_24; };
nodejs-slim_25 = callPackage ../development/web/nodejs/v25.nix { };
nodejs_25 = symlinkJoin {
pname = "nodejs";
inherit (nodejs-slim_25) version passthru meta;
paths = [
nodejs-slim_25
nodejs-slim_25.npm
];
};
nodejs_25 = callPackage ../development/web/nodejs/symlink.nix { nodejs-slim = nodejs-slim_25; };
# Update this when adding the newest nodejs major version!
nodejs_latest = nodejs_25;