diff options
Diffstat (limited to 'modules/containers/watchtower/default.nix')
-rw-r--r-- | modules/containers/watchtower/default.nix | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/modules/containers/watchtower/default.nix b/modules/containers/watchtower/default.nix index bc819cd..b7644ec 100644 --- a/modules/containers/watchtower/default.nix +++ b/modules/containers/watchtower/default.nix @@ -1,15 +1,30 @@ -{ ... }: { - virtualisation.oci-containers.containers.watchtower = { - image = "containrrr/watchtower:latest"; - autoStart = true; - volumes = [ - "/var/run/podman/podman.sock:/var/run/docker.sock:ro" - "/etc/localtime:/etc/localtime:ro" - ]; - environment = { - WATCHTOWER_CLEANUP = "true"; - WATCHTOWER_SCHEDULE = "0 0 5 * * *"; + config, + lib, + ... +}: +with lib; +let + service = "watchtower"; + cfg = config.modules.containers.${service}; +in +{ + options.modules.containers.${service} = { + enable = mkEnableOption service; + }; + + config = mkIf cfg.enable { + virtualisation.oci-containers.containers.${service} = { + image = "containrrr/watchtower:latest"; + autoStart = true; + volumes = [ + "/var/run/podman/podman.sock:/var/run/docker.sock:ro" + "/etc/localtime:/etc/localtime:ro" + ]; + environment = { + WATCHTOWER_CLEANUP = "true"; + WATCHTOWER_SCHEDULE = "0 0 5 * * *"; + }; }; }; } |