From 5ec3e7b30e2c2a60f3571b85392c2fc3dcda74a1 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 28 Oct 2024 16:34:50 +0100 Subject: [PATCH] nodejs_22: use shared SQLite --- pkgs/development/web/nodejs/nodejs.nix | 14 +++++++++++--- pkgs/development/web/nodejs/v22.nix | 6 ++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/pkgs/development/web/nodejs/nodejs.nix b/pkgs/development/web/nodejs/nodejs.nix index 8881d608c95b..86d5897f8e62 100644 --- a/pkgs/development/web/nodejs/nodejs.nix +++ b/pkgs/development/web/nodejs/nodejs.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, openssl, python, zlib, libuv, http-parser, icu, bash +{ lib, stdenv, fetchurl, openssl, python, zlib, libuv, sqlite, http-parser, icu, bash , ninja, pkgconf, unixtools, runCommand, buildPackages , testers # for `.pkgs` attribute @@ -97,8 +97,15 @@ let # TODO: also handle MIPS flags (mips_arch, mips_fpu, mips_float_abi). useSharedHttpParser = !stdenv.hostPlatform.isDarwin && lib.versionOlder "${majorVersion}.${minorVersion}" "11.4"; + useSharedSQLite = lib.versionAtLeast version "22.5"; - sharedLibDeps = { inherit openssl zlib libuv; } // (lib.optionalAttrs useSharedHttpParser { inherit http-parser; }); + sharedLibDeps = { + inherit openssl zlib libuv; + } // (lib.optionalAttrs useSharedHttpParser { + inherit http-parser; + }) // (lib.optionalAttrs useSharedSQLite { + inherit sqlite; + }); copyLibHeaders = map @@ -151,7 +158,8 @@ let # wrappers over the corresponding JS scripts. There are some packages though # that use bash wrappers, e.g. polaris-web. buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ CoreServices ApplicationServices ] - ++ [ zlib libuv openssl http-parser icu bash ]; + ++ [ zlib libuv openssl http-parser icu bash ] + ++ lib.optionals useSharedSQLite [ sqlite ]; nativeBuildInputs = [ diff --git a/pkgs/development/web/nodejs/v22.nix b/pkgs/development/web/nodejs/v22.nix index 6a71b0056bf7..7f8367464eb7 100644 --- a/pkgs/development/web/nodejs/v22.nix +++ b/pkgs/development/web/nodejs/v22.nix @@ -18,5 +18,11 @@ buildNodejs { ./node-npm-build-npm-package-logic.patch ./use-correct-env-in-tests.patch ./bin-sh-node-run-v22.patch + + # Patch to use the shared version of SQLite instead of the one vendored upstream: + (fetchpatch2 { + url = "https://github.com/nodejs/node/commit/32f7d5ad1cf79e7e731e1bb7ac967f4f2a3194cf.patch?full_index=1"; + hash = "sha256-dyUr3caGfetrXgfAl+CLE1LKKetDZCpPwMg4EM98rqI="; + }) ]; }