fix: build nodejs with overwrite*

and don't copy the rest of the build scripts

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
This commit is contained in:
Harald Hoyer 2024-03-22 08:34:36 +01:00
parent 4617b69a45
commit 7afe2bbed7
Signed by: harald
GPG key ID: F519A1143B3FBE32
20 changed files with 8 additions and 1590 deletions

View file

@ -1,33 +1,10 @@
{ callPackage, lib, overrideCC, pkgs, buildPackages, fetchpatch, openssl, python3, nixsgx, enableNpm ? false }:
args@{ callPackage, lib, overrideCC, pkgs, buildPackages, fetchpatch, openssl, python3, nixsgx, nodejs_18, enableNpm ? false }:
let
# Clang 16+ cannot build Node v18 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;
libuv = nixsgx.libuv;
};
callPackage' = p: a: callPackage p (a // { inherit (nixsgx) libuv; });
nodejs_libuv = nodejs_18.override { callPackage = callPackage'; };
nodejs_patched = nodejs_libuv.overrideAttrs (prevAttrs: {
inherit enableNpm;
configureFlags = prevAttrs.configureFlags ++ [ "--without-node-snapshot" ];
});
in
buildNodejs {
inherit enableNpm;
version = "18.18.2";
sha256 = "sha256-ckni8K+UPsOFmVBPSyor0x+5OHhykbbMymyLrfAeO1Y=";
patches = [
./disable-darwin-v8-system-instrumentation.patch
./bypass-darwin-xcrun-node16.patch
./revert-arm64-pointer-auth.patch
./node-npm-build-npm-package-logic.patch
./trap-handler-backport.patch
];
}
nodejs_patched