diff --git a/pkgs/development/web/nodejs/v16.nix b/pkgs/development/web/nodejs/v16.nix index d4bb94c07d3e..930b648ca559 100644 --- a/pkgs/development/web/nodejs/v16.nix +++ b/pkgs/development/web/nodejs/v16.nix @@ -1,8 +1,20 @@ -{ callPackage, openssl, python3, fetchpatch, enableNpm ? true }: +{ callPackage, lib, overrideCC, pkgs, buildPackages, openssl, python3, fetchpatch, enableNpm ? true }: let + # Clang 16+ cannot build Node v14 due to -Wenum-constexpr-conversion errors. + # Use an older version of clang with the current libc++ for compatibility (e.g., with icu). + ensureCompatibleCC = packages: + if packages.stdenv.cc.isClang && lib.versionAtLeast (lib.getVersion packages.stdenv.cc.cc) "16" + then overrideCC packages.llvmPackages_15.stdenv (packages.llvmPackages_15.stdenv.cc.override { + inherit (packages.llvmPackages) libcxx; + extraPackages = [ packages.llvmPackages.libcxxabi ]; + }) + else packages.stdenv; + buildNodejs = callPackage ./nodejs.nix { inherit openssl; + stdenv = ensureCompatibleCC pkgs; + buildPackages = buildPackages // { stdenv = ensureCompatibleCC buildPackages; }; python = python3; };