From 86bf66c817b23168c2fcd579c9941d6c99cf3e86 Mon Sep 17 00:00:00 2001 From: Timo Boomers Date: Fri, 2 May 2025 16:43:49 +0200 Subject: [PATCH] Added storage and home assistant --- hosts/v-th-ctr-01/home.nix | 2 + modules/home/containers/caddy.nix | 15 ++++++++ modules/home/containers/homeassistant.nix | 31 +++++++++++++++ modules/home/containers/homepage.nix | 1 + modules/home/containers/storage.nix | 47 +++++++++++++++++++++++ modules/home/default.nix | 2 + 6 files changed, 98 insertions(+) create mode 100644 modules/home/containers/homeassistant.nix create mode 100644 modules/home/containers/storage.nix diff --git a/hosts/v-th-ctr-01/home.nix b/hosts/v-th-ctr-01/home.nix index c0639a8..b78c324 100644 --- a/hosts/v-th-ctr-01/home.nix +++ b/hosts/v-th-ctr-01/home.nix @@ -50,6 +50,8 @@ vaultwarden.enable = true; paperless-ngx.enable = true; beszel.enable = true; + storage.enable = true; + homeassistant.enable = true; }; }; diff --git a/modules/home/containers/caddy.nix b/modules/home/containers/caddy.nix index 1964b15..2b70a0b 100644 --- a/modules/home/containers/caddy.nix +++ b/modules/home/containers/caddy.nix @@ -71,6 +71,11 @@ in { handle @pingvin-share { reverse_proxy pingvin-share:3000 } + + @dufs host files.tbmrs.nl + handle @dufs { + reverse_proxy dufs:5000 + } } *.local.tbmrs.nl { @@ -93,6 +98,16 @@ in { handle @beszel { reverse_proxy beszel:8090 } + + @syncthing host syncthing.local.tbmrs.nl + handle @syncthing { + reverse_proxy syncthing:8384 + } + + @homeassistant host home-assistant.local.tbmrs.nl + handle @homeassistant { + reverse_proxy homeassistant:8123 + } } ''; }; diff --git a/modules/home/containers/homeassistant.nix b/modules/home/containers/homeassistant.nix new file mode 100644 index 0000000..7dea2b1 --- /dev/null +++ b/modules/home/containers/homeassistant.nix @@ -0,0 +1,31 @@ +{ config, lib, ... }: + +with lib; + +let + cfg = config.settings.containers.homeassistant; +in { + options = { + settings.containers.homeassistant.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enable storage configuration + ''; + }; + }; + + config = mkIf cfg.enable { + services.podman.containers.homeassistant = { + image = "ghcr.io/home-assistant/home-assistant:stable"; + network = "proxy"; + volumes = [ + "%h/containers/homeassistant/config:/config" + ]; + userNS = "keep-id"; + environment = { + TZ = "Europe/Amsterdam"; + }; + }; + }; +} diff --git a/modules/home/containers/homepage.nix b/modules/home/containers/homepage.nix index b553725..f80fe5a 100644 --- a/modules/home/containers/homepage.nix +++ b/modules/home/containers/homepage.nix @@ -26,6 +26,7 @@ in { "%h/containers/homepage/config/docker.yaml:/app/config/docker.yaml" "/run/user/1000/podman/podman.sock:/var/run/podman.sock:ro" ]; + userNS = "keep-id"; environment = { HOMEPAGE_ALLOWED_HOSTS = "home.tbmrs.nl"; }; diff --git a/modules/home/containers/storage.nix b/modules/home/containers/storage.nix new file mode 100644 index 0000000..f779a83 --- /dev/null +++ b/modules/home/containers/storage.nix @@ -0,0 +1,47 @@ +{ config, lib, ... }: + +with lib; + +let + cfg = config.settings.containers.storage; +in { + options = { + settings.containers.storage.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enable storage configuration + ''; + }; + }; + + config = mkIf cfg.enable { + services.podman.containers.dufs = { + image = "sigoden/dufs"; + network = "proxy"; + volumes = [ + "%h/storage:/data" + ]; + userNS = "keep-id"; + environment = { + DUFS_SERVE_PATH = "data"; + DUFS_AUTH = "@/tboomers/public:ro|tboomers:password@/tboomers:rw"; + DUFS_ALLOW_ALL = true; + }; + }; + + services.podman.containers.syncthing = { + image = "syncthing/syncthing"; + network = "proxy"; + volumes = [ + "%h/storage:/storage" + "%h/containers/syncthing/data:/var/syncthing" + ]; + userNS = "keep-id"; + ports = [ + "22000:22000/tcp" + "22000:22000/udp" + ]; + }; + }; +} diff --git a/modules/home/default.nix b/modules/home/default.nix index 2acfa23..b53b30d 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -37,5 +37,7 @@ ./containers/vaultwarden.nix ./containers/paperless-ngx.nix ./containers/beszel.nix + ./containers/storage.nix + ./containers/homeassistant.nix ]; }