aboutsummaryrefslogtreecommitdiff
path: root/modules/containers/watchtower
diff options
context:
space:
mode:
authortdback <tyler@tdback.net>2025-01-26 11:31:39 -0500
committertdback <tyler@tdback.net>2025-01-26 11:31:39 -0500
commit1b40ddcb978dec8cf52a82319f1f8b4e4eedd3f8 (patch)
treeaf7b6b2ff316e42fa8c59ff772970a16a3b8c4cb /modules/containers/watchtower
parenta7c3d07078d0ca67afadd6fb24ab4b60b38c1109 (diff)
containers: reworked each container to be a standalone module
Diffstat (limited to 'modules/containers/watchtower')
-rw-r--r--modules/containers/watchtower/default.nix37
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 * * *";
+ };
};
};
}