nix-gitlab-ci/lib/flakeModule.nix
Jairo Llopis ab41bc24ec
feat: auto-generate CI jobs from flake checks
Add `checks` option and `config.autoChecks` to auto-generate a CI job
for each flake check derivation. Auto-generated jobs go through
`mkJobPatched` for proper Nix setup, cache, and environment handling.

The `checks` option is automatically wired to `config.checks` in
flake-parts. System is inferred from `pkgs.system` and set via the new
`system` option. User-defined jobs with the same name always take
precedence.

New tests cover both flake-parts and direct API entry points.

MT-14138
2026-05-11 08:02:44 +01:00

30 lines
568 B
Nix

{
flake-parts-lib,
lib,
...
}: {
options.perSystem = flake-parts-lib.mkPerSystemOption (
{
config,
pkgs,
...
}: let
cilib = import ./. {inherit lib pkgs;};
inherit (lib) types mkOption;
in {
options = {
ci = mkOption {
type = types.submodule cilib.modules.nixCiSubmodule;
default = {};
};
};
config = {
ci = {
inherit (config) checks;
inherit (pkgs) system;
};
legacyPackages = config.ci.packages;
};
}
);
}