Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 41 additions & 104 deletions pkgs/tools/package-management/nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
lib,
config,
stdenv,
aws-sdk-cpp,
boehmgc,
callPackage,
nixDependencies,
generateSplicesForMkScope,
fetchFromGitHub,
fetchpatch2,
Expand All @@ -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 <thread>' -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
Expand Down Expand Up @@ -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
Expand All @@ -249,17 +167,36 @@ lib.makeExtensible (
self_attribute_name = "nix_2_25";
};

nixComponents_2_26 = (
callPackage ./vendor/2_26/componentized.nix {
inherit (self.nix_2_24.meta) maintainers;
otherSplices = generateSplicesForNixComponents "nixComponents_2_26";
}
);
nixComponents_2_26 = nixDependencies.callPackage ./modular/packages.nix {
version = "2.26.3";
inherit (self.nix_2_24.meta) maintainers;
otherSplices = generateSplicesForNixComponents "nixComponents_2_26";
src = fetchFromGitHub {
owner = "NixOS";
repo = "nix";
rev = "42fc03dd1f12df2d9152303f3fb8bf22b746462c";
hash = "sha256-5ZV8YqU8mfFmoAMiUEuBqNwk0T3vUR//x1D12BiYCeY=";
};
};

# Note, this might eventually become an alias, as packages should
# depend on the components they need in `nixComponents_2_26`.
nix_2_26 = addTests "nix_2_26" self.nixComponents_2_26.nix-everything;

nixComponents_2_27 = nixDependencies.callPackage ./modular/packages.nix {
version = "2.27.1";
inherit (self.nix_2_24.meta) maintainers;
otherSplices = generateSplicesForNixComponents "nixComponents_2_26";
src = fetchFromGitHub {
owner = "NixOS";
repo = "nix";
rev = "9cb662df7442a1e2c4600fb8ecb2ad613ebc5a95";
hash = "sha256-rBPulEBpn4IiqkPsetuh7BRzT2iGCzZYnogTAsbrvhU=";
};
};

nix_2_27 = addTests "nix_2_27" self.nixComponents_2_27.nix-everything;

latest = self.nix_2_26;

# The minimum Nix version supported by Nixpkgs
Expand Down
22 changes: 22 additions & 0 deletions pkgs/tools/package-management/nix/dependencies-scope.nix
Original file line number Diff line number Diff line change
@@ -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;
}
102 changes: 102 additions & 0 deletions pkgs/tools/package-management/nix/dependencies.nix
Original file line number Diff line number Diff line change
@@ -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 <thread>' -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 = [ ];
};
};
}
6 changes: 6 additions & 0 deletions pkgs/tools/package-management/nix/modular/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# `nix/modular`

This directory follows a directory structure similar to that in the upstream repo,
to make comparisons easier.

The files are maintained separately from the upstream repo, so differences are expected.
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
lib,
fetchFromGitHub,
splicePackages,
generateSplicesForMkScope,
newScope,
nixDependencies,
pkgs,
stdenv,
maintainers,
otherSplices,
version,
src,
}:
let
officialRelease = true;
src = fetchFromGitHub (builtins.fromJSON (builtins.readFile ./source.json));

# A new scope, so that we can use `callPackage` to inject our own interdependencies
# without "polluting" the top level "`pkgs`" attrset.
Expand All @@ -32,26 +30,10 @@ let
officialRelease
pkgs
src
version
;
};
};

# 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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
src,
officialRelease,
maintainers,
version,
}:

scope:
Expand All @@ -27,7 +28,7 @@ let
pkg-config
;

baseVersion = lib.fileContents ../.version;
baseVersion = version;

versionSuffix = lib.optionalString (!officialRelease) "pre";

Expand Down
Loading