diff --git a/lib/attrsets.nix b/lib/attrsets.nix index 5575e9577029..de88763854d6 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 7d6f11a593cf..aafea2a8779a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2192,7 +2192,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 = @@ -2200,7 +2203,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 bac3d1b1171d..61116328b29f 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;