From 9aa683efe7f6e3fbba92bdace135c837f7355f65 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 31 Mar 2025 17:53:25 +0200 Subject: [PATCH] nixVersions.*: Remove coroutine sp patch and factor out nixDependencies Note that the file itself is still referenced by Lix 2.90. --- pkgs/tools/package-management/nix/default.nix | 116 +++--------------- .../nix/dependencies-scope.nix | 22 ++++ .../package-management/nix/dependencies.nix | 102 +++++++++++++++ .../nix/vendor/2_26/componentized.nix | 21 +--- .../nix/vendor/2_26/dependencies.nix | 46 ------- pkgs/top-level/all-packages.nix | 4 + 6 files changed, 146 insertions(+), 165 deletions(-) create mode 100644 pkgs/tools/package-management/nix/dependencies-scope.nix create mode 100644 pkgs/tools/package-management/nix/dependencies.nix delete mode 100644 pkgs/tools/package-management/nix/vendor/2_26/dependencies.nix diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix index 8fab66bb2aea..872078b1b830 100644 --- a/pkgs/tools/package-management/nix/default.nix +++ b/pkgs/tools/package-management/nix/default.nix @@ -2,9 +2,7 @@ lib, config, stdenv, - aws-sdk-cpp, - boehmgc, - callPackage, + nixDependencies, generateSplicesForMkScope, fetchFromGitHub, fetchpatch2, @@ -20,99 +18,22 @@ confDir ? "/etc", }: let - boehmgc-nix_2_3 = boehmgc.override { enableLargeConfig = true; }; - - boehmgc-nix = boehmgc-nix_2_3.overrideAttrs (drv: { - patches = (drv.patches or [ ]) ++ [ - # Part of the GC solution in https://github.com/NixOS/nix/pull/4944 - ./patches/boehmgc-coroutine-sp-fallback.patch - ]; - }); - - # old nix fails to build with newer aws-sdk-cpp and the patch doesn't apply - aws-sdk-cpp-old-nix = - (aws-sdk-cpp.override { - apis = [ - "s3" - "transfer" - ]; - customMemoryManagement = false; - }).overrideAttrs - (args: rec { - # intentionally overriding postPatch - version = "1.9.294"; - - src = fetchFromGitHub { - owner = "aws"; - repo = "aws-sdk-cpp"; - rev = version; - hash = "sha256-Z1eRKW+8nVD53GkNyYlZjCcT74MqFqqRMeMc33eIQ9g="; - }; - postPatch = - '' - # Avoid blanket -Werror to evade build failures on less - # tested compilers. - substituteInPlace cmake/compiler_settings.cmake \ - --replace '"-Werror"' ' ' - - # Missing includes for GCC11 - sed '5i#include ' -i \ - aws-cpp-sdk-cloudfront-integration-tests/CloudfrontOperationTest.cpp \ - aws-cpp-sdk-cognitoidentity-integration-tests/IdentityPoolOperationTest.cpp \ - aws-cpp-sdk-dynamodb-integration-tests/TableOperationTest.cpp \ - aws-cpp-sdk-elasticfilesystem-integration-tests/ElasticFileSystemTest.cpp \ - aws-cpp-sdk-lambda-integration-tests/FunctionTest.cpp \ - aws-cpp-sdk-mediastore-data-integration-tests/MediaStoreDataTest.cpp \ - aws-cpp-sdk-queues/source/sqs/SQSQueue.cpp \ - aws-cpp-sdk-redshift-integration-tests/RedshiftClientTest.cpp \ - aws-cpp-sdk-s3-crt-integration-tests/BucketAndObjectOperationTest.cpp \ - aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp \ - aws-cpp-sdk-s3control-integration-tests/S3ControlTest.cpp \ - aws-cpp-sdk-sqs-integration-tests/QueueOperationTest.cpp \ - aws-cpp-sdk-transfer-tests/TransferTests.cpp - # Flaky on Hydra - rm aws-cpp-sdk-core-tests/aws/auth/AWSCredentialsProviderTest.cpp - # Includes aws-c-auth private headers, so only works with submodule build - rm aws-cpp-sdk-core-tests/aws/auth/AWSAuthSignerTest.cpp - # TestRandomURLMultiThreaded fails - rm aws-cpp-sdk-core-tests/http/HttpClientTest.cpp - '' - + lib.optionalString aws-sdk-cpp.stdenv.hostPlatform.isi686 '' - # EPSILON is exceeded - rm aws-cpp-sdk-core-tests/aws/client/AdaptiveRetryStrategyTest.cpp - ''; - - patches = (args.patches or [ ]) ++ [ ./patches/aws-sdk-cpp-TransferManager-ContentEncoding.patch ]; - - # only a stripped down version is build which takes a lot less resources to build - requiredSystemFeatures = [ ]; - }); - - aws-sdk-cpp-nix = - (aws-sdk-cpp.override { - apis = [ - "s3" - "transfer" - ]; - customMemoryManagement = false; - }).overrideAttrs - { - # only a stripped down version is build which takes a lot less resources to build - requiredSystemFeatures = [ ]; - }; + # Called for Nix < 2.26 common = args: - callPackage (import ./common.nix ({ inherit lib fetchFromGitHub; } // args)) { + nixDependencies.callPackage (import ./common.nix ({ inherit lib fetchFromGitHub; } // args)) { inherit Security storeDir stateDir confDir ; - boehmgc = boehmgc-nix; aws-sdk-cpp = - if lib.versionAtLeast args.version "2.12pre" then aws-sdk-cpp-nix else aws-sdk-cpp-old-nix; + if lib.versionAtLeast args.version "2.12pre" then + nixDependencies.aws-sdk-cpp + else + nixDependencies.aws-sdk-cpp-old; }; # https://github.com/NixOS/nix/pull/7585 @@ -219,18 +140,15 @@ lib.makeExtensible ( ( { nix_2_3 = - ( - (common { - version = "2.3.18"; - hash = "sha256-jBz2Ub65eFYG+aWgSI3AJYvLSghio77fWQiIW1svA9U="; - patches = [ - patch-monitorfdhup - ]; - self_attribute_name = "nix_2_3"; - maintainers = with lib.maintainers; [ flokli ]; - }).override - { boehmgc = boehmgc-nix_2_3; } - ).overrideAttrs + (common { + version = "2.3.18"; + hash = "sha256-jBz2Ub65eFYG+aWgSI3AJYvLSghio77fWQiIW1svA9U="; + patches = [ + patch-monitorfdhup + ]; + self_attribute_name = "nix_2_3"; + maintainers = with lib.maintainers; [ flokli ]; + }).overrideAttrs { # https://github.com/NixOS/nix/issues/10222 # spurious test/add.sh failures @@ -250,7 +168,7 @@ lib.makeExtensible ( }; nixComponents_2_26 = ( - callPackage ./vendor/2_26/componentized.nix { + nixDependencies.callPackage ./vendor/2_26/componentized.nix { inherit (self.nix_2_24.meta) maintainers; otherSplices = generateSplicesForNixComponents "nixComponents_2_26"; } diff --git a/pkgs/tools/package-management/nix/dependencies-scope.nix b/pkgs/tools/package-management/nix/dependencies-scope.nix new file mode 100644 index 000000000000..cb562dad3505 --- /dev/null +++ b/pkgs/tools/package-management/nix/dependencies-scope.nix @@ -0,0 +1,22 @@ +{ + lib, + generateSplicesForMkScope, + newScope, + splicePackages, + callPackage, +}: + +let + otherSplices = generateSplicesForMkScope [ "nixDependencies" ]; +in +lib.makeScopeWithSplicing' + { + inherit splicePackages; + inherit newScope; # layered directly on pkgs, unlike nixComponents above + } + { + # Technically this should point to the nixDependencies set only, but + # this is ok as long as the scopes don't intersect. + inherit otherSplices; + f = (callPackage ./dependencies.nix { }).scopeFunction; + } diff --git a/pkgs/tools/package-management/nix/dependencies.nix b/pkgs/tools/package-management/nix/dependencies.nix new file mode 100644 index 000000000000..a1a964836959 --- /dev/null +++ b/pkgs/tools/package-management/nix/dependencies.nix @@ -0,0 +1,102 @@ +regular@{ + lib, + boehmgc, + aws-sdk-cpp, + fetchFromGitHub, + pkgs, + stdenv, +}: + +let + stdenv = + if regular.stdenv.isDarwin && regular.stdenv.isx86_64 then darwinStdenv else regular.stdenv; + + # Fix the following error with the default x86_64-darwin SDK: + # + # error: aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on macOS 10.13 or newer + # + # Despite the use of the 10.13 deployment target here, the aligned + # allocation function Clang uses with this setting actually works + # all the way back to 10.6. + darwinStdenv = regular.pkgs.overrideSDK regular.stdenv { darwinMinVersion = "10.13"; }; +in + +{ + scopeFunction = scope: { + inherit stdenv; + + boehmgc = regular.boehmgc.override { enableLargeConfig = true; }; + + # old nix fails to build with newer aws-sdk-cpp and the patch doesn't apply + aws-sdk-cpp-old = + (regular.aws-sdk-cpp.override { + apis = [ + "s3" + "transfer" + ]; + customMemoryManagement = false; + }).overrideAttrs + (args: rec { + # intentionally overriding postPatch + version = "1.9.294"; + + src = fetchFromGitHub { + owner = "aws"; + repo = "aws-sdk-cpp"; + rev = version; + hash = "sha256-Z1eRKW+8nVD53GkNyYlZjCcT74MqFqqRMeMc33eIQ9g="; + }; + postPatch = + '' + # Avoid blanket -Werror to evade build failures on less + # tested compilers. + substituteInPlace cmake/compiler_settings.cmake \ + --replace '"-Werror"' ' ' + + # Missing includes for GCC11 + sed '5i#include ' -i \ + aws-cpp-sdk-cloudfront-integration-tests/CloudfrontOperationTest.cpp \ + aws-cpp-sdk-cognitoidentity-integration-tests/IdentityPoolOperationTest.cpp \ + aws-cpp-sdk-dynamodb-integration-tests/TableOperationTest.cpp \ + aws-cpp-sdk-elasticfilesystem-integration-tests/ElasticFileSystemTest.cpp \ + aws-cpp-sdk-lambda-integration-tests/FunctionTest.cpp \ + aws-cpp-sdk-mediastore-data-integration-tests/MediaStoreDataTest.cpp \ + aws-cpp-sdk-queues/source/sqs/SQSQueue.cpp \ + aws-cpp-sdk-redshift-integration-tests/RedshiftClientTest.cpp \ + aws-cpp-sdk-s3-crt-integration-tests/BucketAndObjectOperationTest.cpp \ + aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp \ + aws-cpp-sdk-s3control-integration-tests/S3ControlTest.cpp \ + aws-cpp-sdk-sqs-integration-tests/QueueOperationTest.cpp \ + aws-cpp-sdk-transfer-tests/TransferTests.cpp + # Flaky on Hydra + rm aws-cpp-sdk-core-tests/aws/auth/AWSCredentialsProviderTest.cpp + # Includes aws-c-auth private headers, so only works with submodule build + rm aws-cpp-sdk-core-tests/aws/auth/AWSAuthSignerTest.cpp + # TestRandomURLMultiThreaded fails + rm aws-cpp-sdk-core-tests/http/HttpClientTest.cpp + '' + + lib.optionalString aws-sdk-cpp.stdenv.hostPlatform.isi686 '' + # EPSILON is exceeded + rm aws-cpp-sdk-core-tests/aws/client/AdaptiveRetryStrategyTest.cpp + ''; + + patches = (args.patches or [ ]) ++ [ ./patches/aws-sdk-cpp-TransferManager-ContentEncoding.patch ]; + + # only a stripped down version is build which takes a lot less resources to build + requiredSystemFeatures = [ ]; + }); + + aws-sdk-cpp = + (regular.aws-sdk-cpp.override { + apis = [ + "s3" + "transfer" + ]; + customMemoryManagement = false; + }).overrideAttrs + { + # only a stripped down version is build which takes a lot less resources to build + requiredSystemFeatures = [ ]; + }; + }; +} diff --git a/pkgs/tools/package-management/nix/vendor/2_26/componentized.nix b/pkgs/tools/package-management/nix/vendor/2_26/componentized.nix index 21b16a98f241..9f51901c052a 100644 --- a/pkgs/tools/package-management/nix/vendor/2_26/componentized.nix +++ b/pkgs/tools/package-management/nix/vendor/2_26/componentized.nix @@ -2,10 +2,8 @@ lib, fetchFromGitHub, splicePackages, - generateSplicesForMkScope, - newScope, + nixDependencies, pkgs, - stdenv, maintainers, otherSplices, }: @@ -36,22 +34,5 @@ let }; }; - # The dependencies are in their own scope, so that they don't have to be - # in Nixpkgs top level `pkgs` or `nixComponents`. - nixDependencies = - lib.makeScopeWithSplicing' - { - inherit splicePackages; - inherit newScope; # layered directly on pkgs, unlike nixComponents above - } - { - # Technically this should point to the nixDependencies set only, but - # this is ok as long as the scopes don't intersect. - inherit otherSplices; - f = import ./dependencies.nix { - inherit pkgs; - inherit stdenv; - }; - }; in nixComponents.overrideSource src diff --git a/pkgs/tools/package-management/nix/vendor/2_26/dependencies.nix b/pkgs/tools/package-management/nix/vendor/2_26/dependencies.nix deleted file mode 100644 index 0e874d990188..000000000000 --- a/pkgs/tools/package-management/nix/vendor/2_26/dependencies.nix +++ /dev/null @@ -1,46 +0,0 @@ -# These overrides are applied to the dependencies of the Nix components. - -{ - # The raw Nixpkgs, not affected by this scope - pkgs, - - stdenv, -}: - -let - prevStdenv = stdenv; -in - -let - stdenv = if prevStdenv.isDarwin && prevStdenv.isx86_64 then darwinStdenv else prevStdenv; - - # Fix the following error with the default x86_64-darwin SDK: - # - # error: aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on macOS 10.13 or newer - # - # Despite the use of the 10.13 deployment target here, the aligned - # allocation function Clang uses with this setting actually works - # all the way back to 10.6. - darwinStdenv = pkgs.overrideSDK prevStdenv { darwinMinVersion = "10.13"; }; -in -scope: { - inherit stdenv; - - aws-sdk-cpp = - (pkgs.aws-sdk-cpp.override { - apis = [ - "s3" - "transfer" - ]; - customMemoryManagement = false; - }).overrideAttrs - { - # only a stripped down version is built, which takes a lot less resources - # to build, so we don't need a "big-parallel" machine. - requiredSystemFeatures = [ ]; - }; - - boehmgc = pkgs.boehmgc.override { - enableLargeConfig = true; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 01cee5c744ab..5f59def54830 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18894,6 +18894,10 @@ with pkgs; muse = libsForQt5.callPackage ../applications/audio/muse { }; + nixDependencies = recurseIntoAttrs ( + callPackage ../tools/package-management/nix/dependencies-scope.nix { } + ); + nixVersions = recurseIntoAttrs ( callPackage ../tools/package-management/nix { storeDir = config.nix.storeDir or "/nix/store";