diff --git a/lib/attrsets.nix b/lib/attrsets.nix index 5575e9577029ae6..de88763854d6953 100644 --- a/lib/attrsets.nix +++ b/lib/attrsets.nix @@ -622,6 +622,20 @@ rec { dontRecurseIntoAttrs = attrs: attrs // { recurseForDerivations = false; }; + /* `unionOfDisjoint x y` is equal to `x // y // z` where the + attrnames in `z` are the intersection of the attrnames in `x` and + `y`, and all values `assert` with an error message. This + operator is commutative, unlike (//). */ + unionOfDisjoint = x: y: + let + intersection = builtins.intersectAttrs x y; + collisions = lib.concatStringsSep " " (builtins.attrNames intersection); + mask = builtins.mapAttrs (name: value: builtins.throw + "unionOfDisjoint: collision on ${name}; complete list: ${collisions}") + intersection; + in + (x // y) // mask; + /*** deprecated stuff ***/ zipWithNames = zipAttrsWithNames; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f2c6b822923859f..3ecb1dcd68f538a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2186,7 +2186,10 @@ with pkgs; brewtarget = libsForQt514.callPackage ../applications/misc/brewtarget { } ; - stdenvBootstrapTools = if stdenv.hostPlatform.isDarwin then + # Derivation's result is not used by nixpkgs. Useful for validation for + # regressions of bootstrapTools on hydra and on ofborg. Example: + # pkgsCross.aarch64-multiplatform.freshBootstrapTools.build + freshBootstrapTools = if stdenv.hostPlatform.isDarwin then callPackage ../stdenv/darwin/make-bootstrap-tools.nix { localSystem = stdenv.buildPlatform; crossSystem = @@ -2194,7 +2197,7 @@ with pkgs; } else if stdenv.hostPlatform.isLinux then callPackage ../stdenv/linux/make-bootstrap-tools.nix {} - else throw "stdenvBootstrapTools: unknown hostPlatform ${stdenv.hostPlatform.config}"; + else throw "freshBootstrapTools: unknown hostPlatform ${stdenv.hostPlatform.config}"; boxes = callPackage ../tools/text/boxes { }; diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix index bac3d1b1171ddb6..61116328b29f506 100644 --- a/pkgs/top-level/release.nix +++ b/pkgs/top-level/release.nix @@ -30,7 +30,7 @@ let "aarch64" ] (arch: builtins.elem "${arch}-darwin" systemsWithAnySupport); - jobs = + nonPackageJobs = { tarball = import ./make-tarball.nix { inherit pkgs nixpkgs officialRelease supportedSystems; }; metrics = import ./metrics.nix { inherit pkgs nixpkgs; }; @@ -167,7 +167,9 @@ let (system: { inherit (import ../stdenv/linux/make-bootstrap-tools.nix { - localSystem = { inherit system; }; + pkgs = import ../.. { + localSystem = { inherit system; }; + }; }) dist test; }) @@ -175,7 +177,9 @@ let // optionalAttrs supportDarwin.x86_64 { x86_64-darwin = let - bootstrap = import ../stdenv/darwin/make-bootstrap-tools.nix { system = "x86_64-darwin"; }; + bootstrap = import ../stdenv/darwin/make-bootstrap-tools.nix { + localSystem = { system = "x86_64-darwin"; }; + }; in { # Lightweight distribution and test inherit (bootstrap) dist test; @@ -186,14 +190,25 @@ let # Cross compiled bootstrap tools aarch64-darwin = let - bootstrap = import ../stdenv/darwin/make-bootstrap-tools.nix { system = "x86_64-darwin"; crossSystem = "aarch64-darwin"; }; + bootstrap = import ../stdenv/darwin/make-bootstrap-tools.nix { + localSystem = { system = "x86_64-darwin"; }; + crossSystem = { system = "aarch64-darwin"; }; + }; in { # Distribution only for now inherit (bootstrap) dist; }; }; - } // (mapTestOn ((packagePlatforms pkgs) // { + }; + + # Do not allow attribute collision between jobs inserted in + # 'nonPackageAttrs' and jobs pulled in from 'pkgs'. + # Conflicts usually cause silent job drops like in + # https://github.com/NixOS/nixpkgs/pull/182058 + jobs = lib.attrsets.unionOfDisjoint + nonPackageJobs + (mapTestOn ((packagePlatforms pkgs) // { haskell.compiler = packagePlatforms pkgs.haskell.compiler; haskellPackages = packagePlatforms pkgs.haskellPackages; idrisPackages = packagePlatforms pkgs.idrisPackages;