restructure dockers, add watchtower

This commit is contained in:
2025-10-04 17:10:10 -05:00
parent 3bd8726620
commit c94e6a207c
5 changed files with 43 additions and 4 deletions

View File

@@ -21,6 +21,9 @@
zfs.enable = true;
smb.enable = true;
nfs.enable = true;
docker = {
watchtower.enable = true;
};
};
};

View File

@@ -6,7 +6,7 @@
./hardware-configuration.nix
../../users/blake/blake.nix
../../modules/system/system.nix
../../modules/homelab/ddns_docker.nix
../../modules/homelab/dockers/ddns.nix
];
modules = {
@@ -18,7 +18,7 @@
nvidia.enable = false;
};
homelab = {
ddns_docker.enable = true;
docker.ddns.enable = true;
};
};

View File

@@ -2,10 +2,10 @@
{
options = {
modules.homelab.ddns_docker.enable = lib.mkEnableOption "enable ddns docker";
modules.homelab.docker.ddns.enable = lib.mkEnableOption "enable ddns docker";
};
config = lib.mkIf config.modules.homelab.ddns_docker.enable {
config = lib.mkIf config.modules.homelab.docker.ddns.enable {
let
api_token = builtins.readFile /home/blake/.keyring/ddns/api_token;
zone_id_blakedheld = builtins.readFile /home/blake/.keyring/ddns/zone_id_blakedheld;

View File

@@ -0,0 +1,13 @@
{ pkgs, config, lib, ... }:
{
imports = [
./watchtowner.nix
./ddns.nix
];
modules.homelab.docker.watchtower.enable = lib.mkDefault true;
modules.homelab.docker.ddns.enable = lib.mkDefault false;
}

View File

@@ -0,0 +1,23 @@
{ pkgs, config, lib, ... }:
{
options = {
modules.homelab.docker.watchtower.enable = lib.mkEnableOption "enable watchtower docker";
};
config = lib.mkIf config.modules.homelab.docker.watchtower.enable {
virtualisation.docker.containers.watchtower = {
image = "containrrr/watchtower";
containerName = "watchtower";
restartPolicy = "unless-stopped";
environment = {
TZ = "America/Chicago";
WATCHTOWER_INCLUDE_RESTARTING = "America/Chicago";
WATCHTOWER_CLEANUP = "true";
WATCHTOWER_POLL_INTERVAL = "43200";
};
volumes = [ "/var/run/docker.sock:/var/run/docker.sock" ];
};
};
}