1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

Merge pull request #10962 from hercules-ci/tidy-packages-matrix

flake.nix: Tidy `packages` build matrix code
This commit is contained in:
John Ericson 2024-06-25 22:06:33 -04:00 committed by GitHub
commit a92f3071bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -351,36 +351,40 @@
// devFlake.checks.${system} or {} // devFlake.checks.${system} or {}
); );
packages = forAllSystems (system: { packages = forAllSystems (system:
inherit (nixpkgsFor.${system}.native) { # Here we put attributes that map 1:1 into packages.<system>, ie
changelog-d; # for which we don't apply the full build matrix such as cross or static.
default = self.packages.${system}.nix; inherit (nixpkgsFor.${system}.native)
nix-internal-api-docs = nixpkgsFor.${system}.native.nix-internal-api-docs; changelog-d;
nix-external-api-docs = nixpkgsFor.${system}.native.nix-external-api-docs; default = self.packages.${system}.nix;
} // lib.concatMapAttrs nix-internal-api-docs = nixpkgsFor.${system}.native.nix-internal-api-docs;
# We need to flatten recursive attribute sets of derivations to pass `flake check`. nix-external-api-docs = nixpkgsFor.${system}.native.nix-external-api-docs;
(pkgName: {}: {
"${pkgName}" = nixpkgsFor.${system}.native.${pkgName};
"${pkgName}-static" = nixpkgsFor.${system}.static.${pkgName};
} // lib.concatMapAttrs
(crossSystem: {}: {
"${pkgName}-${crossSystem}" = nixpkgsFor.${system}.cross.${crossSystem}.${pkgName};
})
(lib.genAttrs crossSystems (_: { }))
// lib.concatMapAttrs
(stdenvName: {}: {
"${pkgName}-${stdenvName}" = nixpkgsFor.${system}.stdenvs."${stdenvName}Packages".${pkgName};
})
(lib.genAttrs stdenvs (_: { })))
{
"nix" = { };
# Temporarily disabled because GitHub Actions OOM issues. Once
# the old build system is gone and we are back to one build
# system, we should reenable these.
#"nix-util" = { };
#"nix-store" = { };
#"nix-fetchers" = { };
} }
# We need to flatten recursive attribute sets of derivations to pass `flake check`.
// flatMapAttrs
{ # Components we'll iterate over in the upcoming lambda
"nix" = { };
# Temporarily disabled because GitHub Actions OOM issues. Once
# the old build system is gone and we are back to one build
# system, we should reenable these.
#"nix-util" = { };
#"nix-store" = { };
#"nix-fetchers" = { };
}
(pkgName: {}: {
# These attributes go right into `packages.<system>`.
"${pkgName}" = nixpkgsFor.${system}.native.${pkgName};
"${pkgName}-static" = nixpkgsFor.${system}.static.${pkgName};
}
// flatMapAttrs (lib.genAttrs crossSystems (_: { })) (crossSystem: {}: {
# These attributes go right into `packages.<system>`.
"${pkgName}-${crossSystem}" = nixpkgsFor.${system}.cross.${crossSystem}.${pkgName};
})
// flatMapAttrs (lib.genAttrs stdenvs (_: { })) (stdenvName: {}: {
# These attributes go right into `packages.<system>`.
"${pkgName}-${stdenvName}" = nixpkgsFor.${system}.stdenvs."${stdenvName}Packages".${pkgName};
})
)
// lib.optionalAttrs (builtins.elem system linux64BitSystems) { // lib.optionalAttrs (builtins.elem system linux64BitSystems) {
dockerImage = dockerImage =
let let