From f29d66a77f6f5de17158037eef7e52b4f555ce77 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Fri, 2 Feb 2024 07:27:40 -0500 Subject: [PATCH 1/3] mongodb: Use scons 4 --- pkgs/servers/nosql/mongodb/mongodb.nix | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pkgs/servers/nosql/mongodb/mongodb.nix b/pkgs/servers/nosql/mongodb/mongodb.nix index c37f06d5e8bd..2b0c1b1aca14 100644 --- a/pkgs/servers/nosql/mongodb/mongodb.nix +++ b/pkgs/servers/nosql/mongodb/mongodb.nix @@ -1,7 +1,7 @@ { lib , stdenv , fetchurl -, scons_3_1_2 +, scons , boost , gperftools , pcre-cpp @@ -44,8 +44,6 @@ let pymongo ]); - scons = scons_3_1_2; - mozjsVersion = "60"; mozjsReplace = "defined(HAVE___SINCOS)"; @@ -58,8 +56,6 @@ let setuptools ]); - scons = scons_3_1_2; - mozjsVersion = "60"; mozjsReplace = "defined(HAVE___SINCOS)"; @@ -87,7 +83,7 @@ in stdenv.mkDerivation rec { inherit sha256; }; - nativeBuildInputs = [ variants.scons ] + nativeBuildInputs = [ scons ] ++ lib.optionals (versionAtLeast version "4.4") [ xz ]; buildInputs = [ From f6086df42f4d50444871e5683e446ed98a740280 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Fri, 2 Feb 2024 07:31:51 -0500 Subject: [PATCH 2/3] mongodb: Eliminate 'variants' redundancy. --- pkgs/servers/nosql/mongodb/mongodb.nix | 42 ++++++++------------------ 1 file changed, 13 insertions(+), 29 deletions(-) diff --git a/pkgs/servers/nosql/mongodb/mongodb.nix b/pkgs/servers/nosql/mongodb/mongodb.nix index 2b0c1b1aca14..666e04ccd2be 100644 --- a/pkgs/servers/nosql/mongodb/mongodb.nix +++ b/pkgs/servers/nosql/mongodb/mongodb.nix @@ -32,34 +32,18 @@ with lib; }: let - variants = - if versionAtLeast version "6.0" - then rec { - python = scons.python.withPackages (ps: with ps; [ - pyyaml - cheetah3 - psutil - setuptools - packaging - pymongo - ]); + python = scons.python.withPackages (ps: with ps; [ + pyyaml + cheetah3 + psutil + setuptools + ] ++ lib.optionals (versionAtLeast version "6.0") [ + packaging + pymongo + ]); - mozjsVersion = "60"; - mozjsReplace = "defined(HAVE___SINCOS)"; - - } - else rec { - python = scons.python.withPackages (ps: with ps; [ - pyyaml - cheetah3 - psutil - setuptools - ]); - - mozjsVersion = "60"; - mozjsReplace = "defined(HAVE___SINCOS)"; - - }; + mozjsVersion = "60"; + mozjsReplace = "defined(HAVE___SINCOS)"; system-libraries = [ "boost" @@ -95,7 +79,7 @@ in stdenv.mkDerivation rec { openssl openldap pcre-cpp - variants.python + python sasl snappy zlib @@ -123,7 +107,7 @@ in stdenv.mkDerivation rec { # remove -march overriding, we know better. sed -i 's/env.Append.*-march=.*$/pass/' SConstruct '' + lib.optionalString (stdenv.isDarwin && versionOlder version "6.0") '' - substituteInPlace src/third_party/mozjs-${variants.mozjsVersion}/extract/js/src/jsmath.cpp --replace '${variants.mozjsReplace}' 0 + substituteInPlace src/third_party/mozjs-${mozjsVersion}/extract/js/src/jsmath.cpp --replace '${mozjsReplace}' 0 '' + lib.optionalString (stdenv.isDarwin && versionOlder version "3.6") '' substituteInPlace src/third_party/s2/s1angle.cc --replace drem remainder substituteInPlace src/third_party/s2/s1interval.cc --replace drem remainder From 9bfa405ab4494e6e23e8645ff98156132d3f6629 Mon Sep 17 00:00:00 2001 From: Will Fancher Date: Fri, 2 Feb 2024 07:34:06 -0500 Subject: [PATCH 3/3] mongodb: Fix cross compilation --- pkgs/servers/nosql/mongodb/mongodb.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pkgs/servers/nosql/mongodb/mongodb.nix b/pkgs/servers/nosql/mongodb/mongodb.nix index 666e04ccd2be..928e50a0ae8c 100644 --- a/pkgs/servers/nosql/mongodb/mongodb.nix +++ b/pkgs/servers/nosql/mongodb/mongodb.nix @@ -1,7 +1,7 @@ { lib , stdenv , fetchurl -, scons +, buildPackages , boost , gperftools , pcre-cpp @@ -32,6 +32,7 @@ with lib; }: let + scons = buildPackages.scons; python = scons.python.withPackages (ps: with ps; [ pyyaml cheetah3 @@ -67,8 +68,10 @@ in stdenv.mkDerivation rec { inherit sha256; }; - nativeBuildInputs = [ scons ] - ++ lib.optionals (versionAtLeast version "4.4") [ xz ]; + nativeBuildInputs = [ + scons + python + ] ++ lib.optional stdenv.isLinux net-snmp; buildInputs = [ boost @@ -79,13 +82,12 @@ in stdenv.mkDerivation rec { openssl openldap pcre-cpp - python sasl snappy zlib ] ++ lib.optionals stdenv.isDarwin [ Security CoreFoundation cctools ] - ++ lib.optionals stdenv.isLinux [ net-snmp ]; - + ++ lib.optional stdenv.isLinux net-snmp + ++ lib.optionals (versionAtLeast version "4.4") [ xz ]; # MongoDB keeps track of its build parameters, which tricks nix into # keeping dependencies to build inputs in the final output. @@ -142,6 +144,7 @@ in stdenv.mkDerivation rec { preBuild = '' sconsFlags+=" CC=$CC" sconsFlags+=" CXX=$CXX" + sconsFlags+=" AR=$AR" '' + optionalString stdenv.isAarch64 '' sconsFlags+=" CCFLAGS='-march=armv8-a+crc'" '';