Skip to content

Commit dbcb81f

Browse files
authored
nodejs: make nodejs_* depend on nodejs-slim_* (NixOS#481461)
2 parents e217c74 + 7459fe9 commit dbcb81f

13 files changed

Lines changed: 101 additions & 51 deletions

File tree

doc/release-notes/rl-2605.section.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@
143143
144144
- `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.
145145
146+
- `nodejs-slim` has a `npm` output, and `nodejs` no longer has a `libv8` output.
147+
146148
- 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.
147149
148150
- `vimPlugins.nvim-treesitter` has been updated to `main` branch, which is a full and incompatible rewrite. If you can't or don't want to update, you should use `vimPlugins.nvim-treesitter-legacy`.

pkgs/by-name/th/thelounge/package.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
fetchFromGitHub,
55
fetchYarnDeps,
66
nodejs,
7+
nodejs-slim,
78
yarn,
89
fixup-yarn-lock,
910
python3,
@@ -84,7 +85,7 @@ stdenv.mkDerivation (finalAttrs: {
8485
rm -rf node_modules/sqlite3/build-tmp-napi-v6/{Release/obj.target,node_sqlite3.target.mk}
8586
'';
8687

87-
disallowedReferences = [ nodejs.src ];
88+
disallowedReferences = [ nodejs-slim.src ];
8889

8990
dontNpmPrune = true;
9091

pkgs/by-name/x2/x2t/package.nix

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
jdk,
1717
lib,
1818
nodejs_22,
19+
nodejs-slim_22,
1920
openssl,
2021
pkg-config,
2122
python3,
@@ -704,7 +705,7 @@ let
704705
qmakeFlags
705706
++ icuQmakeFlags
706707
++ [
707-
# c++1z for nodejs_22.libv8 (20 seems to produce errors around 'is_void_v' there)
708+
# c++1z for nodejs-slim_22.libv8 (20 seems to produce errors around 'is_void_v' there)
708709
# c++ 20 for nodejs_23.libv8
709710
"CONFIG+=c++2a"
710711
# v8_base.h will set nMaxVirtualMemory to 4000000000/5000000000
@@ -735,8 +736,8 @@ let
735736
echo "== v8 =="
736737
mkdir -p Common/3dParty/v8_89/v8/out.gn/linux_64
737738
# using nodejs_22 here is a workaround for https://github.com/NixOS/nixpkgs/issues/477805
738-
ln -s ${nodejs_22.libv8}/lib Common/3dParty/v8_89/v8/out.gn/linux_64/obj
739-
tar xf ${nodejs_22.libv8.src} --one-top-level=/tmp/xxxxx
739+
ln -s ${nodejs-slim_22.libv8}/lib Common/3dParty/v8_89/v8/out.gn/linux_64/obj
740+
tar xf ${nodejs-slim_22.libv8.src} --one-top-level=/tmp/xxxxx
740741
for i in /tmp/xxxxx/*/deps/v8/*; do
741742
cp -r $i Common/3dParty/v8_89/v8/
742743
done

pkgs/development/r-modules/default.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ let
958958
rustc
959959
];
960960
vdiffr = [ pkgs.libpng.dev ];
961-
V8 = [ pkgs.nodejs_22.libv8 ]; # when unpinning the version, don't forget about the other usages later
961+
V8 = [ pkgs.nodejs-slim_22.libv8 ]; # when unpinning the version, don't forget about the other usages later
962962
xactonomial = with pkgs; [
963963
cargo
964964
rustc
@@ -2515,8 +2515,8 @@ let
25152515

25162516
preConfigure = ''
25172517
# when unpinning the version, don't forget about the other usage earlier
2518-
export INCLUDE_DIR=${pkgs.nodejs_22.libv8}/include
2519-
export LIB_DIR=${pkgs.nodejs_22.libv8}/lib
2518+
export INCLUDE_DIR=${pkgs.nodejs-slim_22.libv8}/include
2519+
export LIB_DIR=${pkgs.nodejs-slim_22.libv8}/lib
25202520
patchShebangs configure
25212521
'';
25222522

pkgs/development/ruby-modules/gem-config/default.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
which,
3232
libiconv,
3333
libpq,
34-
nodejs,
34+
nodejs-slim,
3535
clang,
3636
sqlite,
3737
zlib,
@@ -338,7 +338,7 @@ in
338338

339339
mini_racer = attrs: {
340340
buildFlags = [
341-
"--with-v8-dir=\"${nodejs.libv8}\""
341+
"--with-v8-dir=\"${nodejs-slim.libv8}\""
342342
];
343343
dontBuild = false;
344344
postPatch = ''
@@ -699,7 +699,7 @@ in
699699
};
700700

701701
execjs = attrs: {
702-
propagatedBuildInputs = [ nodejs.libv8 ];
702+
propagatedBuildInputs = [ nodejs-slim.libv8 ];
703703
};
704704

705705
libxml-ruby = attrs: {

pkgs/development/web/nodejs/nodejs.nix

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
}:
5858

5959
{
60-
enableNpm ? true,
6160
version,
6261
sha256,
6362
patches ? [ ],
@@ -68,7 +67,7 @@ let
6867
majorVersion = lib.versions.major version;
6968
minorVersion = lib.versions.minor version;
7069

71-
pname = if enableNpm then "nodejs" else "nodejs-slim";
70+
pname = "nodejs-slim";
7271

7372
canExecute = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
7473
emulator = stdenv.hostPlatform.emulator buildPackages;
@@ -274,6 +273,7 @@ let
274273
outputs = [
275274
"out"
276275
"libv8"
276+
"npm"
277277
]
278278
++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [ "dev" ];
279279
setOutputFlags = false;
@@ -299,7 +299,6 @@ let
299299
"--emulator=${emulator}"
300300
]
301301
++ lib.optionals (lib.versionOlder version "19") [ "--without-dtrace" ]
302-
++ lib.optionals (!enableNpm) [ "--without-npm" ]
303302
++ lib.concatMap (name: [
304303
"--shared-${name}"
305304
"--shared-${name}-libpath=${lib.getLib sharedLibDeps.${name}}/lib"
@@ -352,12 +351,17 @@ let
352351

353352
inherit patches;
354353

355-
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
354+
postPatch = ''
355+
substituteInPlace tools/install.py \
356+
--replace-fail ' npm_files(options, action)' " oip=options.install_path;options.install_path='$npm';npm_files(options, action);options.install_path=oip"
357+
''
358+
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
356359
substituteInPlace test/parallel/test-macos-app-sandbox.js \
357360
--subst-var-by codesign '${darwin.sigtool}/bin/codesign'
358361
'';
359362

360363
__darwinAllowLocalNetworking = true; # for tests
364+
__structuredAttrs = true; # for outputChecks
361365

362366
doCheck = canExecute;
363367

@@ -498,6 +502,27 @@ let
498502
}"
499503
];
500504

505+
outputChecks = {
506+
out = {
507+
disallowedReferences = [
508+
"npm"
509+
"libv8"
510+
];
511+
};
512+
libv8 = {
513+
disallowedReferences = [
514+
"out"
515+
"npm"
516+
];
517+
};
518+
npm = {
519+
disallowedReferences = [
520+
"out"
521+
"libv8"
522+
];
523+
};
524+
};
525+
501526
sandboxProfile = ''
502527
(allow file-read*
503528
(literal "/Library/Keychains/System.keychain")
@@ -542,17 +567,9 @@ let
542567
installShellCompletion node.bash
543568
''}
544569
545-
${lib.optionalString enableNpm ''
546-
mkdir -p $out/share/bash-completion/completions
547-
ln -s $out/lib/node_modules/npm/lib/utils/completion.sh \
548-
$out/share/bash-completion/completions/npm
549-
for dir in "$out/lib/node_modules/npm/man/"*; do
550-
mkdir -p $out/share/man/$(basename "$dir")
551-
for page in "$dir"/*; do
552-
ln -rs $page $out/share/man/$(basename "$dir")
553-
done
554-
done
555-
''}
570+
mkdir -p $npm/share/bash-completion/completions
571+
ln -s $npm/lib/node_modules/npm/lib/utils/completion.sh \
572+
$npm/share/bash-completion/completions/npm
556573
557574
# install the missing headers for node-gyp
558575
# TODO: use propagatedBuildInputs instead of copying headers.
@@ -591,6 +608,15 @@ let
591608
cp -r $out/include $dev/include
592609
'';
593610

611+
postFixup = ''
612+
for dir in "$npm/lib/node_modules/npm/man/"*; do
613+
mkdir -p $npm/share/man/$(basename "$dir")
614+
for page in "$dir"/*; do
615+
ln -rs $page $npm/share/man/$(basename "$dir")
616+
done
617+
done
618+
'';
619+
594620
passthru.tests = {
595621
version = testers.testVersion {
596622
package = self;

pkgs/development/web/nodejs/v20.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
fetchpatch2,
66
openssl,
77
python3,
8-
enableNpm ? true,
98
}:
109

1110
let
@@ -35,7 +34,6 @@ let
3534
];
3635
in
3736
buildNodejs {
38-
inherit enableNpm;
3937
version = "20.20.0";
4038
sha256 = "5294d9d2915620e819e6892fd7e545b98d650bad36dae54e6527eaac482add98";
4139
patches = [

pkgs/development/web/nodejs/v22.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
fetchpatch2,
77
openssl,
88
python3,
9-
enableNpm ? true,
109
}:
1110

1211
let
@@ -22,7 +21,6 @@ let
2221
[ ];
2322
in
2423
buildNodejs {
25-
inherit enableNpm;
2624
version = "22.22.0";
2725
sha256 = "4c138012bb5352f49822a8f3e6d1db71e00639d0c36d5b6756f91e4c6f30b683";
2826
patches =

pkgs/development/web/nodejs/v24.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
fetchpatch2,
77
openssl,
88
python3,
9-
enableNpm ? true,
109
}:
1110

1211
let
@@ -24,7 +23,6 @@ let
2423
[ ];
2524
in
2625
buildNodejs {
27-
inherit enableNpm;
2826
version = "24.13.0";
2927
sha256 = "320fe909cbb347dcf516201e4964ef177b8138df9a7f810d0d54950481b3158b";
3028
patches =

pkgs/development/web/nodejs/v25.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
fetchpatch2,
77
openssl,
88
python3,
9-
enableNpm ? true,
109
}:
1110

1211
let
@@ -24,7 +23,6 @@ let
2423
[ ];
2524
in
2625
buildNodejs {
27-
inherit enableNpm;
2826
version = "25.6.0";
2927
sha256 = "9db6848c802b1981c0faeb71a5b8cc79913f82a747f7f1d50260c6d2f781ef7e";
3028
patches =

0 commit comments

Comments
 (0)