|
57 | 57 | }: |
58 | 58 |
|
59 | 59 | { |
60 | | - enableNpm ? true, |
61 | 60 | version, |
62 | 61 | sha256, |
63 | 62 | patches ? [ ], |
|
68 | 67 | majorVersion = lib.versions.major version; |
69 | 68 | minorVersion = lib.versions.minor version; |
70 | 69 |
|
71 | | - pname = if enableNpm then "nodejs" else "nodejs-slim"; |
| 70 | + pname = "nodejs-slim"; |
72 | 71 |
|
73 | 72 | canExecute = stdenv.buildPlatform.canExecute stdenv.hostPlatform; |
74 | 73 | emulator = stdenv.hostPlatform.emulator buildPackages; |
|
274 | 273 | outputs = [ |
275 | 274 | "out" |
276 | 275 | "libv8" |
| 276 | + "npm" |
277 | 277 | ] |
278 | 278 | ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [ "dev" ]; |
279 | 279 | setOutputFlags = false; |
|
299 | 299 | "--emulator=${emulator}" |
300 | 300 | ] |
301 | 301 | ++ lib.optionals (lib.versionOlder version "19") [ "--without-dtrace" ] |
302 | | - ++ lib.optionals (!enableNpm) [ "--without-npm" ] |
303 | 302 | ++ lib.concatMap (name: [ |
304 | 303 | "--shared-${name}" |
305 | 304 | "--shared-${name}-libpath=${lib.getLib sharedLibDeps.${name}}/lib" |
@@ -352,12 +351,17 @@ let |
352 | 351 |
|
353 | 352 | inherit patches; |
354 | 353 |
|
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 '' |
356 | 359 | substituteInPlace test/parallel/test-macos-app-sandbox.js \ |
357 | 360 | --subst-var-by codesign '${darwin.sigtool}/bin/codesign' |
358 | 361 | ''; |
359 | 362 |
|
360 | 363 | __darwinAllowLocalNetworking = true; # for tests |
| 364 | + __structuredAttrs = true; # for outputChecks |
361 | 365 |
|
362 | 366 | doCheck = canExecute; |
363 | 367 |
|
|
498 | 502 | }" |
499 | 503 | ]; |
500 | 504 |
|
| 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 | + |
501 | 526 | sandboxProfile = '' |
502 | 527 | (allow file-read* |
503 | 528 | (literal "/Library/Keychains/System.keychain") |
|
542 | 567 | installShellCompletion node.bash |
543 | 568 | ''} |
544 | 569 |
|
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 |
556 | 573 |
|
557 | 574 | # install the missing headers for node-gyp |
558 | 575 | # TODO: use propagatedBuildInputs instead of copying headers. |
|
591 | 608 | cp -r $out/include $dev/include |
592 | 609 | ''; |
593 | 610 |
|
| 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 | + |
594 | 620 | passthru.tests = { |
595 | 621 | version = testers.testVersion { |
596 | 622 | package = self; |
|
0 commit comments