15 , storeDir ? "/nix/store"
16 , stateDir ? "/nix/var"
20 boehmgc-nix_2_3 = boehmgc.override { enableLargeConfig = true; };
22 boehmgc-nix = boehmgc-nix_2_3.overrideAttrs (drv: {
23 patches = (drv.patches or [ ]) ++ [
24 # Part of the GC solution in https://github.com/NixOS/nix/pull/4944
25 ./patches/boehmgc-coroutine-sp-fallback.patch
29 # old nix fails to build with newer aws-sdk-cpp and the patch doesn't apply
30 aws-sdk-cpp-old-nix = (aws-sdk-cpp.override {
31 apis = [ "s3" "transfer" ];
32 customMemoryManagement = false;
33 }).overrideAttrs (args: rec {
34 # intentionally overriding postPatch
37 src = fetchFromGitHub {
41 hash = "sha256-Z1eRKW+8nVD53GkNyYlZjCcT74MqFqqRMeMc33eIQ9g=";
44 # Avoid blanket -Werror to evade build failures on less
46 substituteInPlace cmake/compiler_settings.cmake \
47 --replace '"-Werror"' ' '
49 # Missing includes for GCC11
50 sed '5i#include <thread>' -i \
51 aws-cpp-sdk-cloudfront-integration-tests/CloudfrontOperationTest.cpp \
52 aws-cpp-sdk-cognitoidentity-integration-tests/IdentityPoolOperationTest.cpp \
53 aws-cpp-sdk-dynamodb-integration-tests/TableOperationTest.cpp \
54 aws-cpp-sdk-elasticfilesystem-integration-tests/ElasticFileSystemTest.cpp \
55 aws-cpp-sdk-lambda-integration-tests/FunctionTest.cpp \
56 aws-cpp-sdk-mediastore-data-integration-tests/MediaStoreDataTest.cpp \
57 aws-cpp-sdk-queues/source/sqs/SQSQueue.cpp \
58 aws-cpp-sdk-redshift-integration-tests/RedshiftClientTest.cpp \
59 aws-cpp-sdk-s3-crt-integration-tests/BucketAndObjectOperationTest.cpp \
60 aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp \
61 aws-cpp-sdk-s3control-integration-tests/S3ControlTest.cpp \
62 aws-cpp-sdk-sqs-integration-tests/QueueOperationTest.cpp \
63 aws-cpp-sdk-transfer-tests/TransferTests.cpp
65 rm aws-cpp-sdk-core-tests/aws/auth/AWSCredentialsProviderTest.cpp
66 # Includes aws-c-auth private headers, so only works with submodule build
67 rm aws-cpp-sdk-core-tests/aws/auth/AWSAuthSignerTest.cpp
68 # TestRandomURLMultiThreaded fails
69 rm aws-cpp-sdk-core-tests/http/HttpClientTest.cpp
70 '' + lib.optionalString aws-sdk-cpp.stdenv.hostPlatform.isi686 ''
72 rm aws-cpp-sdk-core-tests/aws/client/AdaptiveRetryStrategyTest.cpp
75 patches = (args.patches or [ ]) ++ [ ./patches/aws-sdk-cpp-TransferManager-ContentEncoding.patch ];
77 # only a stripped down version is build which takes a lot less resources to build
78 requiredSystemFeatures = [ ];
81 aws-sdk-cpp-nix = (aws-sdk-cpp.override {
82 apis = [ "s3" "transfer" ];
83 customMemoryManagement = false;
85 # only a stripped down version is build which takes a lot less resources to build
86 requiredSystemFeatures = [ ];
89 libgit2-thin-packfile = libgit2.overrideAttrs (args: {
90 nativeBuildInputs = args.nativeBuildInputs or []
91 # gitMinimal does not build on Windows. See packbuilder patch.
92 ++ lib.optionals (!stdenv.hostPlatform.isWindows) [
93 # Needed for `git apply`; see `prePatch`
94 buildPackages.gitMinimal
96 # Only `git apply` can handle git binary patches
97 prePatch = args.prePatch or ""
98 + lib.optionalString (!stdenv.hostPlatform.isWindows) ''
103 # taken from https://github.com/NixOS/nix/tree/master/packaging/patches
104 patches = (args.patches or []) ++ [
105 ./patches/libgit2-mempack-thin-packfile.patch
106 ] ++ lib.optionals (!stdenv.hostPlatform.isWindows) [
107 ./patches/libgit2-packbuilder-callback-interruptible.patch
113 (import ./common.nix ({ inherit lib fetchFromGitHub; } // args))
115 inherit Security storeDir stateDir confDir;
116 boehmgc = boehmgc-nix;
117 aws-sdk-cpp = if lib.versionAtLeast args.version "2.12pre" then aws-sdk-cpp-nix else aws-sdk-cpp-old-nix;
118 libgit2 = if lib.versionAtLeast args.version "2.25.0" then libgit2-thin-packfile else libgit2;
121 # https://github.com/NixOS/nix/pull/7585
122 patch-monitorfdhup = fetchpatch2 {
123 name = "nix-7585-monitor-fd-hup.patch";
124 url = "https://github.com/NixOS/nix/commit/1df3d62c769dc68c279e89f68fdd3723ed3bcb5a.patch";
125 hash = "sha256-f+F0fUO+bqyPXjt+IXJtISVr589hdc3y+Cdrxznb+Nk=";
128 # Intentionally does not support overrideAttrs etc
129 # Use only for tests that are about the package relation to `pkgs` and/or NixOS.
130 addTestsShallowly = tests: pkg: pkg // {
131 tests = pkg.tests // tests;
132 # In case someone reads the wrong attribute
133 passthru.tests = pkg.tests // tests;
136 addFallbackPathsCheck = pkg: addTestsShallowly
137 { nix-fallback-paths =
138 runCommand "test-nix-fallback-paths-version-equals-nix-stable" {
139 paths = lib.concatStringsSep "\n" (builtins.attrValues (import ../../../../nixos/modules/installer/tools/nix-fallback-paths.nix));
141 # NOTE: name may contain cross compilation details between the pname
142 # and version this is permitted thanks to ([^-]*-)*
143 if [[ "" != $(grep -vE 'nix-([^-]*-)*${lib.strings.replaceStrings ["."] ["\\."] pkg.version}$' <<< "$paths") ]]; then
144 echo "nix-fallback-paths not up to date with nixVersions.stable (nix-${pkg.version})"
145 echo "The following paths are not up to date:"
146 grep -v 'nix-${pkg.version}$' <<< "$paths"
148 echo "Fix it by running in nixpkgs:"
150 echo "curl https://releases.nixos.org/nix/nix-${pkg.version}/fallback-paths.nix >nixos/modules/installer/tools/nix-fallback-paths.nix"
154 echo "nix-fallback-paths versions up to date"
161 in lib.makeExtensible (self: ({
164 hash = "sha256-jBz2Ub65eFYG+aWgSI3AJYvLSghio77fWQiIW1svA9U=";
168 self_attribute_name = "nix_2_3";
169 maintainers = with lib.maintainers; [ flokli ];
170 }).override { boehmgc = boehmgc-nix_2_3; }).overrideAttrs {
171 # https://github.com/NixOS/nix/issues/10222
172 # spurious test/add.sh failures
173 enableParallelChecking = false;
178 hash = "sha256-RrOFlDGmRXcVRV2p2HqHGqvzGNyWoD0Dado/BNlJ1SI=";
179 self_attribute_name = "nix_2_18";
184 hash = "sha256-CkT1SNwRYYQdN2X4cTt1WX3YZfKZFWf7O1YTEo1APfc=";
185 self_attribute_name = "nix_2_19";
190 hash = "sha256-b7smrbPLP/wcoBFCJ8j1UDNj0p4jiKT/6mNlDdlrOXA=";
191 self_attribute_name = "nix_2_20";
196 hash = "sha256-/+TLpd6hvYMJFoeJvVZ+bZzjwY/jP6CxJRGmwKcXbI0=";
197 self_attribute_name = "nix_2_21";
202 hash = "sha256-JWjJzMA+CeyImMgP2dhSBHQW4CS8wg7fc2zQ4WdKuBo=";
203 self_attribute_name = "nix_2_22";
208 hash = "sha256-rugH4TUicHEdVfy3UuAobFIutqbuVco8Yg/z81g7clE=";
209 self_attribute_name = "nix_2_23";
214 hash = "sha256-XdeVy1/d6DEIYb3nOA6JIYF4fwMKNxtwJMgT3pHi+ko=";
215 self_attribute_name = "nix_2_24";
220 hash = "sha256-MZNpb4awWHXU+kGmH58VUB7M9l6UVo33riuQLTbMh4E=";
221 self_attribute_name = "nix_2_25";
226 suffix = "pre20241101_${lib.substring 0 8 src.rev}";
227 src = fetchFromGitHub {
230 rev = "2e5759e3778c460efc5f7cfc4cb0b84827b5ffbe";
231 hash = "sha256-E1Sp0JHtbD1CaGO3UbBH6QajCtOGqcrVfPSKL0n63yo=";
233 self_attribute_name = "git";
236 latest = self.nix_2_25;
238 # The minimum Nix version supported by Nixpkgs
239 # Note that some functionality *might* have been backported into this Nix version,
240 # making this package an inaccurate representation of what features are available
241 # in the actual lowest minver.nix *patch* version.
244 minver = import ../../../../lib/minver.nix;
245 major = lib.versions.major minver;
246 minor = lib.versions.minor minver;
247 attribute = "nix_${major}_${minor}";
248 nix = self.${attribute};
250 if ! self ? ${attribute} then
251 throw "The minimum supported Nix version is ${minver} (declared in lib/minver.nix), but pkgs.nixVersions.${attribute} does not exist."
255 # Read ./README.md before bumping a major release
256 stable = addFallbackPathsCheck self.nix_2_24;
257 } // lib.optionalAttrs config.allowAliases (
258 lib.listToAttrs (map (
261 attr = "nix_2_${toString minor}";
263 lib.nameValuePair attr (throw "${attr} has been removed")
266 unstable = throw "nixVersions.unstable has been removed. For bleeding edge (Nix master, roughly weekly updated) use nixVersions.git, otherwise use nixVersions.latest.";