per-system derivations for hydra agg job

Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
ahuston-0 2024-07-07 22:50:46 -04:00 committed by Alice Huston
parent f5dc1046eb
commit dbc4378f90
2 changed files with 27 additions and 9 deletions

View File

@ -161,7 +161,7 @@
rec {
inherit lib; # for allowing use of custom functions in nix repl
hydraJobs = import ./hydra/jobs.nix { inherit inputs outputs; };
hydraJobs = import ./hydra/jobs.nix { inherit inputs outputs systems; };
formatter = forEachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
nixosConfigurations = genSystems inputs src (src + "/systems");

View File

@ -1,27 +1,45 @@
{ inputs, outputs }:
{
inputs,
outputs,
systems,
}:
let
inherit (inputs.nixpkgs.lib) mapAttrs mapAttrsToList;
inherit (inputs.nixpkgs) lib;
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
getCfg = _: cfg: cfg.config.system.build.toplevel;
hostToAgg = _: cfg: cfg;
# get per-system check derivation (with optional postfix)
mapSystems =
{
check,
postfix ? "",
}:
(map (system: if postfix == "" then check.${system} else check.${system}.${postfix}) systems);
in
rec {
inherit (outputs) formatter devShells checks;
host = mapAttrs getCfg outputs.nixosConfigurations;
host = lib.mapAttrs getCfg outputs.nixosConfigurations;
hosts = pkgs.releaseTools.aggregate {
name = "hosts";
constituents = mapAttrsToList hostToAgg host;
constituents = lib.mapAttrsToList hostToAgg host;
};
devChecks = pkgs.releaseTools.aggregate {
name = "devChecks";
constituents = [
formatter.x86_64-linux
devShells.x86_64-linux
checks.x86_64-linux
constituents = lib.flatten [
(mapSystems { check = formatter; })
(mapSystems {
check = checks;
postfix = "pre-commit-check";
})
(mapSystems {
check = devShells;
postfix = "default";
})
];
};
}