mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +01:00
feat: initial v3 rewrite
This commit is contained in:
commit
0952ab4145
32 changed files with 1457 additions and 0 deletions
61
lib/impl/modules/root.nix
Normal file
61
lib/impl/modules/root.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue