feat: initial v3 rewrite

This commit is contained in:
technofab 2025-09-01 15:04:20 +02:00
commit 0952ab4145
No known key found for this signature in database
32 changed files with 1457 additions and 0 deletions

61
lib/impl/modules/root.nix Normal file
View 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;
};
};
}