nix-gitlab-ci/lib/impl/modules/soonix.nix

61 lines
1.5 KiB
Nix

{
lib,
cilib,
...
}: let
inherit (lib) mkOption types;
in {
soonixSubmodule = {config, ...}: {
options = {
componentVersion = mkOption {
description = "CI/CD component version. Also get's passed to inputs version";
type = types.str;
default = cilib.version;
};
componentUrl = mkOption {
description = "CI/CD component url";
type = types.str;
default = "gitlab.com/TECHNOFAB/nix-gitlab-ci/nix-gitlab-ci";
};
componentInputs = mkOption {
description = "Extra inputs to pass to the CI/CD component";
type = types.attrs;
default = {};
};
extraData = mkOption {
description = "Extra data to include in the .gitlab-ci.yml file";
type = types.attrs;
default = {};
};
finalConfig = mkOption {
internal = true;
type = types.attrs;
};
};
config.finalConfig = {
opts.format = "yaml";
hook = {
mode = "copy";
gitignore = false;
};
output = ".gitlab-ci.yml";
generator = "nix";
data =
cilib.helpers.deepMerge
{
include = [
{
component = "${config.componentUrl}@${config.componentVersion}";
inputs =
{
version = config.componentVersion;
}
// config.componentInputs;
}
];
}
config.extraData;
};
};
}