Add `nixVersions.nix_2_26.overrideScope` (#394744)

authored by Jörg Thalheim and committed by GitHub 39d14940 afd27e16

+39 -18
+4 -15
lib/tests/nix-for-tests.nix
··· 1 1 { 2 + lib ? pkgs.lib, 2 3 pkgs, 3 4 }: 4 5 ··· 13 14 14 15 builtins.mapAttrs ( 15 16 attr: pkg: 16 - if 17 - # TODO descend in `nixComponents_*` and override `nix-store`. Also 18 - # need to introduce the flag needed to do that with. 19 - # 20 - # This must be done before Nix 2.26 and beyond becomes the default. 21 - !(builtins.elem attr [ 22 - "nixComponents_2_26" 23 - "nix_2_26" 24 - "latest" 25 - ]) 26 - # There may-be non-package things, like functions, in there too 27 - && builtins.isAttrs pkg 28 - then 17 + if lib.versionAtLeast pkg.version "2.26" then 18 + pkg.overrideScope (finalScope: prevScope: { aws-sdk-cpp = null; }) 19 + else 29 20 pkg.override { withAWS = false; } 30 - else 31 - pkg 32 21 ) pkgs.nixVersions
+35 -3
pkgs/tools/package-management/nix/vendor/2_26/packaging/components.nix
··· 240 240 241 241 /** 242 242 Apply an extension function (i.e. overlay-shaped) to all component derivations. 243 + 244 + Single argument: the extension function to apply (finalAttrs: prevAttrs: { ... }) 243 245 */ 244 246 overrideAllMesonComponents = 245 247 f: ··· 253 255 Provide an alternate source. This allows the expressions to be vendored without copying the sources, 254 256 but it does make the build non-granular; all components will use a complete source. 255 257 256 - Packaging expressions will be ignored. 258 + Filesets in the packaging expressions will be ignored. 259 + 260 + Single argument: the source to use. 261 + 262 + See also `appendPatches` 257 263 */ 258 264 overrideSource = 259 265 src: ··· 294 300 This affects all components. 295 301 296 302 Changes to the packaging expressions will be ignored. 303 + 304 + Single argument: list of patches to apply 305 + 306 + See also `overrideSource` 297 307 */ 298 308 appendPatches = 299 309 patches: ··· 367 377 nix-perl-bindings = callPackage ../src/perl/package.nix { }; 368 378 369 379 nix-everything = callPackage ../packaging/everything.nix { } // { 370 - # Note: no `passthru.overrideAllMesonComponents` 380 + # Note: no `passthru.overrideAllMesonComponents` etc 371 381 # This would propagate into `nix.overrideAttrs f`, but then discard 372 382 # `f` when `.overrideAllMesonComponents` is used. 373 383 # Both "methods" should be views on the same fixpoint overriding mechanism ··· 375 385 # two-fixpoint solution. 376 386 /** 377 387 Apply an extension function (i.e. overlay-shaped) to all component derivations, and return the nix package. 388 + 389 + Single argument: the extension function to apply (finalAttrs: prevAttrs: { ... }) 378 390 */ 379 391 overrideAllMesonComponents = f: (scope.overrideAllMesonComponents f).nix-everything; 380 392 ··· 383 395 This affects all components. 384 396 385 397 Changes to the packaging expressions will be ignored. 398 + 399 + Single argument: list of patches to apply 400 + 401 + See also `overrideSource` 386 402 */ 387 403 appendPatches = ps: (scope.appendPatches ps).nix-everything; 388 404 ··· 390 406 Provide an alternate source. This allows the expressions to be vendored without copying the sources, 391 407 but it does make the build non-granular; all components will use a complete source. 392 408 393 - Packaging expressions will be ignored. 409 + Filesets in the packaging expressions will be ignored. 410 + 411 + Single argument: the source to use. 412 + 413 + See also `appendPatches` 394 414 */ 395 415 overrideSource = src: (scope.overrideSource src).nix-everything; 416 + 417 + /** 418 + Override any internals of the Nix package set. 419 + 420 + Single argument: the extension function to apply to the package set (finalScope: prevScope: { ... }) 421 + 422 + Example: 423 + ``` 424 + overrideScope (finalScope: prevScope: { aws-sdk-cpp = null; }) 425 + ``` 426 + */ 427 + overrideScope = f: (scope.overrideScope f).nix-everything; 396 428 397 429 }; 398 430 }