diff --git a/pkgs/development/web/nodejs/nodejs.nix b/pkgs/development/web/nodejs/nodejs.nix index 72615b356222..ab9a8b95d1a0 100644 --- a/pkgs/development/web/nodejs/nodejs.nix +++ b/pkgs/development/web/nodejs/nodejs.nix @@ -1,5 +1,5 @@ { lib, stdenv, fetchurl, openssl, python, zlib, libuv, util-linux, http-parser -, pkg-config, which +, pkg-config, which, buildPackages # for `.pkgs` attribute , callPackage # Updater dependencies @@ -19,7 +19,7 @@ let majorVersion = versions.major version; minorVersion = versions.minor version; - baseName = if enableNpm then "nodejs" else "nodejs-slim"; + pname = if enableNpm then "nodejs" else "nodejs-slim"; useSharedHttpParser = !stdenv.isDarwin && versionOlder "${majorVersion}.${minorVersion}" "11.4"; @@ -43,15 +43,17 @@ let extraConfigFlags = optionals (!enableNpm) [ "--without-npm" ]; self = stdenv.mkDerivation { - inherit version; - - name = "${baseName}-${version}"; + inherit pname version; src = fetchurl { url = "https://nodejs.org/dist/v${version}/node-v${version}.tar.xz"; inherit sha256; }; + CC_host = "cc"; + CXX_host = "c++"; + depsBuildBuild = [ buildPackages.stdenv.cc openssl libuv zlib ]; + buildInputs = optionals stdenv.isDarwin [ CoreServices ApplicationServices ] ++ [ zlib libuv openssl http-parser icu ]; @@ -71,12 +73,23 @@ let "--cross-compiling" "--without-intl" "--without-snapshot" + "--dest-cpu=${let platform = stdenv.hostPlatform; in + if platform.isAarch32 then "arm" + else if platform.isAarch64 then "arm64" + else if platform.isMips32 && platform.isLittleEndian then "mipsel" + else if platform.isMips32 && !platform.isLittleEndian then "mips" + else if platform.isMips64 && platform.isLittleEndian then "mips64el" + else if platform.isPower && platform.is32bit then "ppc" + else if platform.isPower && platform.is64bit then "ppc64" + else if platform.isx86_64 then "x86_64" + else if platform.isx86_32 then "x86" + else if platform.isS390 && platform.is64bit then "s390x" + else if platform.isRiscV && platform.is64bit then "riscv64" + else throw "unsupported cpu ${stdenv.hostPlatform.uname.processor}"}" ]) ++ (optionals (isCross && isAarch32 && hasAttr "fpu" gcc) [ "--with-arm-fpu=${gcc.fpu}" ]) ++ (optionals (isCross && isAarch32 && hasAttr "float-abi" gcc) [ "--with-arm-float-abi=${gcc.float-abi}" - ]) ++ (optionals (isCross && isAarch32) [ - "--dest-cpu=arm" ]) ++ extraConfigFlags; configurePlatforms = []; @@ -123,7 +136,7 @@ let ${optionalString (enableNpm && stdenv.hostPlatform == stdenv.buildPlatform) '' mkdir -p $out/share/bash-completion/completions/ - $out/bin/npm completion > $out/share/bash-completion/completions/npm + HOME=$TMPDIR $out/bin/npm completion > $out/share/bash-completion/completions/npm for dir in "$out/lib/node_modules/npm/man/"*; do mkdir -p $out/share/man/$(basename "$dir") for page in "$dir"/*; do @@ -181,7 +194,7 @@ let maintainers = with maintainers; [ goibhniu gilligan cko marsam ]; platforms = platforms.linux ++ platforms.darwin; mainProgram = "node"; - knownVulnerabilities = optional (versionOlder version "12") "This NodeJS release has reached its end of life. See https://nodejs.org/en/about/releases/."; + knownVulnerabilities = optional (versionOlder version "14") "This NodeJS release has reached its end of life. See https://nodejs.org/en/about/releases/."; }; passthru.python = python; # to ensure nodeEnv uses the same version diff --git a/pkgs/development/web/nodejs/v12.nix b/pkgs/development/web/nodejs/v12.nix index e2db169bad37..ea7c211163e2 100644 --- a/pkgs/development/web/nodejs/v12.nix +++ b/pkgs/development/web/nodejs/v12.nix @@ -8,7 +8,7 @@ let in buildNodejs { inherit enableNpm; - version = "12.22.11"; - sha256 = "sha256-XoHaJv1bH4lxRIOrqmjj2jBFI+QzTHjEm/p6A+541vE="; + version = "12.22.12"; + sha256 = "1whl0zi6fs9ay33bhcn2kh9xynran05iipahg1zzr6sv97wbfhmw"; patches = lib.optional stdenv.isDarwin ./bypass-xcodebuild.diff; } diff --git a/pkgs/development/web/nodejs/v14.nix b/pkgs/development/web/nodejs/v14.nix index e2a65ace3811..7cae7dd557a2 100644 --- a/pkgs/development/web/nodejs/v14.nix +++ b/pkgs/development/web/nodejs/v14.nix @@ -7,7 +7,7 @@ let in buildNodejs { inherit enableNpm; - version = "14.19.1"; - sha256 = "sha256-4a4J3YYas5rwRIO7XA+lTd2CtrFVQ76aJ+pnBKi6ndk="; + version = "14.19.3"; + sha256 = "sha256-XPRbHxrKd1I6zzYkDB1TqZknkHCncR6r8jNG+IsMyZQ="; patches = lib.optional stdenv.isDarwin ./bypass-xcodebuild.diff; } diff --git a/pkgs/development/web/nodejs/v16.nix b/pkgs/development/web/nodejs/v16.nix index 7f3dce2d70cf..3c90b7f665a0 100644 --- a/pkgs/development/web/nodejs/v16.nix +++ b/pkgs/development/web/nodejs/v16.nix @@ -1,4 +1,4 @@ -{ callPackage, fetchpatch, openssl, python3, enableNpm ? true }: +{ callPackage, openssl, python3, enableNpm ? true }: let buildNodejs = callPackage ./nodejs.nix { @@ -8,15 +8,9 @@ let in buildNodejs { inherit enableNpm; - version = "16.14.2"; - sha256 = "sha256-6SLiFcxo61+U0z6KC2HiyGO3cxzIYAq5VdOCLakP+NE="; + version = "16.15.0"; + sha256 = "sha256-oPgS78Q/eDIeygiVeWCkj15r+XAE1QWMjdOwPGRupPc="; patches = [ ./disable-darwin-v8-system-instrumentation.patch - # Fixes node incorrectly building vendored OpenSSL when we want system OpenSSL. - # https://github.com/nodejs/node/pull/40965 - (fetchpatch { - url = "https://github.com/nodejs/node/commit/65119a89586b94b0dd46b45f6d315c9d9f4c9261.patch"; - sha256 = "sha256-dihKYEdK68sQIsnfTRambJ2oZr0htROVbNZlFzSAL+I="; - }) ]; } diff --git a/pkgs/development/web/nodejs/v18.nix b/pkgs/development/web/nodejs/v18.nix new file mode 100644 index 000000000000..b0a9924cd82f --- /dev/null +++ b/pkgs/development/web/nodejs/v18.nix @@ -0,0 +1,15 @@ +{ callPackage, python3, enableNpm ? true }: + +let + buildNodejs = callPackage ./nodejs.nix { + python = python3; + }; +in +buildNodejs { + inherit enableNpm; + version = "18.2.0"; + sha256 = "sha256-IwWxXr9VR0dOkFtQAvm6mcfu7wHXOU3+bzhGzGvK1m0="; + patches = [ + ./disable-darwin-v8-system-instrumentation.patch + ]; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c3578924fde3..dbf0fd00d569 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7173,10 +7173,13 @@ with pkgs; nodejs-slim-17_x = callPackage ../development/web/nodejs/v17.nix { enableNpm = false; }; + nodejs-18_x = callPackage ../development/web/nodejs/v18.nix { }; + nodejs-slim-18_x = callPackage ../development/web/nodejs/v18.nix { + enableNpm = false; + }; # Update this when adding the newest nodejs major version! - # Do not set to nodejs-17_x because it requires 10.13 SDK on Darwin - nodejs_latest = nodejs-16_x; - nodejs-slim_latest = nodejs-slim-16_x; + nodejs_latest = nodejs-18_x; + nodejs-slim_latest = nodejs-slim-18_x; nodePackages_latest = dontRecurseIntoAttrs nodejs_latest.pkgs;