nix-dotfiles/hydra/jobs.nix
ahuston-0 dbc4378f90 per-system derivations for hydra agg job
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
2024-07-27 23:52:08 +00:00

46 lines
998 B
Nix

{
inputs,
outputs,
systems,
}:
let
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 = lib.mapAttrs getCfg outputs.nixosConfigurations;
hosts = pkgs.releaseTools.aggregate {
name = "hosts";
constituents = lib.mapAttrsToList hostToAgg host;
};
devChecks = pkgs.releaseTools.aggregate {
name = "devChecks";
constituents = lib.flatten [
(mapSystems { check = formatter; })
(mapSystems {
check = checks;
postfix = "pre-commit-check";
})
(mapSystems {
check = devShells;
postfix = "default";
})
];
};
}