nix-gitlab-ci/lib/default.nix
Jairo Llopis 70dc878112
fix: pipelines can have either trigger or script
They canno thave both, so here I add assertions support and use them to avoid this case.
2026-05-13 08:53:15 +01:00

35 lines
1.1 KiB
Nix

args: let
# allow passing just pkgs aswell for convenience
lib = args.lib or args.pkgs.lib;
# makes it optional to pass if it's not explicitly needed
pkgs = args.pkgs or (throw "[nix-gitlab-ci] pkgs argument was used but not set, please pass it");
inherit (lib) evalModules trimWith;
impl = import ./impl {inherit lib pkgs cilib;};
cilib = {
inherit (impl) helpers modules mkPipeline mkJobRun mkJobDeps mkJobPatched;
utils = import ./utils.nix {inherit pkgs;};
version = trimWith {
start = true;
end = true;
} (builtins.readFile ./VERSION);
mkCI = config:
let
result = (evalModules {
modules = [
cilib.modules.nixCiSubmodule
{
inherit config;
}
];
}).config;
# Check all assertions and warnings using NixOS infrastructure,
# then return the result with internal module options removed
checked = lib.asserts.checkAssertWarn result.assertions result.warnings result;
in
builtins.removeAttrs checked ["assertions" "warnings" "config"];
};
in
cilib