aboutsummaryrefslogtreecommitdiff
path: root/modules/containers/watchtower/default.nix
blob: b7644ece90bd6e84376fc0a959283463da2db447 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
  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 * * *";
      };
    };
  };
}