Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packaging: Make hydraJobs.build.* complete #12578

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 78 additions & 24 deletions packaging/hydra.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,86 @@ let
# Technically we could just return `pkgs.nixComponents`, but for Hydra it's
# convention to transpose it, and to transpose it efficiently, we need to
# enumerate them manually, so that we don't evaluate unnecessary package sets.
forAllPackages = lib.genAttrs [
"nix-everything"
"nix-util"
"nix-util-c"
"nix-util-test-support"
"nix-util-tests"
"nix-store"
"nix-store-c"
"nix-store-test-support"
"nix-store-tests"
"nix-fetchers"
"nix-fetchers-tests"
"nix-expr"
"nix-expr-c"
"nix-expr-test-support"
"nix-expr-tests"
"nix-flake"
"nix-flake-tests"
"nix-main"
"nix-main-c"
"nix-cmd"
"nix-cli"
"nix-functional-tests"
];
# See listingIsComplete below.
forAllPackages = forAllPackages' { };
forAllPackages' =
{
enableBindings ? false,
enableDocs ? false, # already have separate attrs for these
}:
lib.genAttrs (
[
"nix-everything"
"nix-util"
"nix-util-c"
"nix-util-test-support"
"nix-util-tests"
"nix-store"
"nix-store-c"
"nix-store-test-support"
"nix-store-tests"
"nix-fetchers"
"nix-fetchers-tests"
"nix-expr"
"nix-expr-c"
"nix-expr-test-support"
"nix-expr-tests"
"nix-flake"
"nix-flake-c"
"nix-flake-tests"
"nix-main"
"nix-main-c"
"nix-cmd"
"nix-cli"
"nix-functional-tests"
]
++ lib.optionals enableBindings [
"nix-perl-bindings"
]
++ lib.optionals enableDocs [
"nix-manual"
"nix-internal-api-docs"
"nix-external-api-docs"
]
);
in
{
/**
An internal check to make sure our package listing is complete.
*/
listingIsComplete =
let
arbitrarySystem = "x86_64-linux";
listedPkgs = forAllPackages' {
enableBindings = true;
enableDocs = true;
} (_: null);
actualPkgs = lib.concatMapAttrs (
k: v: if lib.strings.hasPrefix "nix-" k then { ${k} = null; } else { }
) nixpkgsFor.${arbitrarySystem}.native.nixComponents;
diff = lib.concatStringsSep "\n" (
lib.concatLists (
lib.mapAttrsToList (
k: _:
if (listedPkgs ? ${k}) && !(actualPkgs ? ${k}) then
[ "- ${k}: redundant?" ]
else if !(listedPkgs ? ${k}) && (actualPkgs ? ${k}) then
[ "- ${k}: missing?" ]
else
[ ]
) (listedPkgs // actualPkgs)
)
);
in
if listedPkgs == actualPkgs then
{ }
else
throw ''
Please update the components list in hydra.nix (or fix this check)
Differences:
${diff}
'';

# Binary package for various platforms.
build = forAllPackages (
pkgName: forAllSystems (system: nixpkgsFor.${system}.native.nixComponents.${pkgName})
Expand Down
Loading