diff options
author | Bruno BELANYI <bruno@belanyi.fr> | 2023-03-23 14:13:26 +0000 |
---|---|---|
committer | Bruno BELANYI <bruno@belanyi.fr> | 2023-03-23 21:33:20 +0000 |
commit | 67de7d105ea6b400d66628b703c69fa171b9f08a (patch) | |
tree | 96fe8c4d9be0866cd7c4101dc99b1fabdfc97b2b /nixos/modules/services/continuous-integration/woodpecker/agents.nix | |
parent | cd116db45e8e31e01f9c20d4fbb7785febed74d8 (diff) |
nixos/woodpecker-agents: per-agent 'enable' option
Diffstat (limited to 'nixos/modules/services/continuous-integration/woodpecker/agents.nix')
-rw-r--r-- | nixos/modules/services/continuous-integration/woodpecker/agents.nix | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/nixos/modules/services/continuous-integration/woodpecker/agents.nix b/nixos/modules/services/continuous-integration/woodpecker/agents.nix index ac6ec45c0ba7b..2dd6e39bdd946 100644 --- a/nixos/modules/services/continuous-integration/woodpecker/agents.nix +++ b/nixos/modules/services/continuous-integration/woodpecker/agents.nix @@ -9,6 +9,8 @@ let agentModule = lib.types.submodule { options = { + enable = lib.mkEnableOption (lib.mdDoc "this Woodpecker-Agent. Agents execute tasks generated by a Server, every install will need one server and at least one agent"); + package = lib.mkPackageOptionMD pkgs "woodpecker-agent" { }; environment = lib.mkOption { @@ -101,8 +103,6 @@ in options = { services.woodpecker-agents = { - enable = lib.mkEnableOption (lib.mdDoc "the Woodpecker-Agent, Agents execute tasks generated by a Server, every install will need one server and at least one agent"); - agents = lib.mkOption { default = { }; type = lib.types.attrsOf agentModule; @@ -133,7 +133,12 @@ in }; }; - config = lib.mkIf cfg.enable { - systemd.services = lib.mapAttrs' mkAgentService cfg.agents; + config = { + systemd.services = + let + mkServices = lib.mapAttrs' mkAgentService; + enabledAgents = lib.filterAttrs (_: agent: agent.enable) cfg.agents; + in + mkServices enabledAgents; }; } |