mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-11 17:50:08 +01:00
61 lines
1.6 KiB
Nix
61 lines
1.6 KiB
Nix
{
|
|
lib,
|
|
soonixSubmodule,
|
|
pipelineSubmodule,
|
|
...
|
|
}: let
|
|
inherit (lib) mkOption types;
|
|
in rec {
|
|
configSubmodule = {
|
|
options = {
|
|
soonix = mkOption {
|
|
description = "Configure the soonix '.gitlab-ci.yml' generation";
|
|
type = types.submodule soonixSubmodule;
|
|
default = {};
|
|
};
|
|
nixJobsByDefault = mkOption {
|
|
description = ''
|
|
Whether to transform all jobs to nix-configured jobs by default.
|
|
If false, you need to set `nix.enable` for each job you want to be transformed.
|
|
'';
|
|
type = types.bool;
|
|
default = true;
|
|
};
|
|
};
|
|
};
|
|
|
|
nixCiSubmodule = {config, ...}: {
|
|
options = {
|
|
config = mkOption {
|
|
description = "Configuration of Nix-GitLab-CI itself";
|
|
type = types.submodule configSubmodule;
|
|
default = {};
|
|
};
|
|
pipelines = mkOption {
|
|
description = "Defines all pipelines";
|
|
type = types.attrsOf (types.submoduleWith {
|
|
modules = [pipelineSubmodule];
|
|
specialArgs.rootConfig = config.config;
|
|
});
|
|
default = {};
|
|
};
|
|
|
|
packages = mkOption {
|
|
description = "Final packages for use in CI";
|
|
internal = true;
|
|
type = types.attrsOf types.package;
|
|
};
|
|
soonix = mkOption {
|
|
description = "Soonix config for .gitlab-ci.yml";
|
|
internal = true;
|
|
type = types.attrs;
|
|
};
|
|
};
|
|
config = {
|
|
packages = lib.fold (pipeline: acc: acc // pipeline) {} (
|
|
map (pipeline: pipeline.packages) (builtins.attrValues config.pipelines)
|
|
);
|
|
soonix = config.config.soonix.finalConfig;
|
|
};
|
|
};
|
|
}
|