From b6a91b7dcbb26b0fc5e5cf9c8e1ec5e24f32f55f Mon Sep 17 00:00:00 2001 From: Timo Boomers Date: Mon, 28 Apr 2025 09:23:05 +0200 Subject: [PATCH] Added homepage, immich and uptime kuma --- hosts/v-th-ctr-01/home.nix | 3 + modules/home/containers/caddy.nix | 15 ++++ modules/home/containers/homepage.nix | 94 +++++++++++++++++++++++++ modules/home/containers/immich.nix | 75 ++++++++++++++++++++ modules/home/containers/uptime-kuma.nix | 27 +++++++ modules/home/default.nix | 3 + 6 files changed, 217 insertions(+) create mode 100644 modules/home/containers/homepage.nix create mode 100644 modules/home/containers/immich.nix create mode 100644 modules/home/containers/uptime-kuma.nix diff --git a/hosts/v-th-ctr-01/home.nix b/hosts/v-th-ctr-01/home.nix index 4a6cf08..fff0b13 100644 --- a/hosts/v-th-ctr-01/home.nix +++ b/hosts/v-th-ctr-01/home.nix @@ -42,6 +42,9 @@ caddy.enable = true; kanidm.enable = true; forgejo.enable = true; + immich.enable = true; + homepage.enable = true; + uptime-kuma.enable = true; }; }; diff --git a/modules/home/containers/caddy.nix b/modules/home/containers/caddy.nix index ad160ea..b448266 100644 --- a/modules/home/containers/caddy.nix +++ b/modules/home/containers/caddy.nix @@ -51,6 +51,21 @@ in { handle @forgejo { reverse_proxy forgejo:3000 } + + @immich host photos.tbmrs.nl + handle @immich { + reverse_proxy immich-server:2283 + } + + @homepage host home.tbmrs.nl + handle @homepage { + reverse_proxy homepage:3000 + } + + @uptime-kuma host uptime.tbmrs.nl + handle @uptime-kuma { + reverse_proxy uptime-kuma:3001 + } } ''; }; diff --git a/modules/home/containers/homepage.nix b/modules/home/containers/homepage.nix new file mode 100644 index 0000000..5e4626b --- /dev/null +++ b/modules/home/containers/homepage.nix @@ -0,0 +1,94 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.settings.containers.homepage; +in { + options = { + settings.containers.homepage.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enable homepage container + ''; + }; + }; + + config = mkIf cfg.enable { + services.podman.containers.homepage = { + image = "ghcr.io/gethomepage/homepage:latest"; + network = "proxy"; + volumes = [ + "%h/containers/homepage/config:/app/config" + "%h/containers/homepage/config/settings.yaml:/app/config/settings.yaml" + "%h/containers/homepage/config/services.yaml:/app/config/services.yaml" + "%h/containers/homepage/config/docker.yaml:/app/config/docker.yaml" + "/run/user/1000/podman/podman.sock:/var/run/podman.sock:ro" + ]; + environment = { + HOMEPAGE_ALLOWED_HOSTS = "home.tbmrs.nl"; + }; + }; + + home.file."containers/homepage/config/settings.yaml".source = (pkgs.formats.yaml { }).generate "settings" { + title = "Timo's Server"; + description = "server from Timo"; + theme = "dark"; + color = "slate"; + }; + + home.file."containers/homepage/config/services.yaml".source = (pkgs.formats.yaml { }).generate "services" [ + { + "Infra" = [ + { + "Kanidm" = { + href = "https://auth.tbmrs.nl"; + description = "Oauth2 and ldap provider"; + icon = "kanidm"; + server = "podman"; + container = "kanidm"; + }; + } + { + "Uptime Kuma" = { + href = "https://uptime.tbmrs.nl"; + description = "Uptime and status"; + icon = "uptime-kuma"; + server = "podman"; + container = "uptime-kuma"; + }; + } + ]; + } + { + "Services" = [ + { + "Forgejo" = { + href = "https://git.tbmrs.nl"; + description = "Git server"; + icon = "forgejo"; + server = "podman"; + container = "forgejo"; + }; + } + { + "Immich" = { + href = "https://photos.tbmrs.nl"; + description = "Photo's and videos"; + icon = "immich"; + server = "podman"; + container = "immich-server"; + }; + } + ]; + } + ]; + + home.file."containers/homepage/config/docker.yaml".source = (pkgs.formats.yaml {}).generate "docker" { + podman = { + socket = "/var/run/podman.sock"; + }; + }; + }; +} diff --git a/modules/home/containers/immich.nix b/modules/home/containers/immich.nix new file mode 100644 index 0000000..77efae6 --- /dev/null +++ b/modules/home/containers/immich.nix @@ -0,0 +1,75 @@ +{ config, lib, ... }: + +with lib; + +let + cfg = config.settings.containers.immich; +in { + options = { + settings.containers.immich.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enable immich container + ''; + }; + }; + + config = mkIf cfg.enable { + services.podman.containers.immich-server = { + image = "ghcr.io/immich-app/immich-server:release"; + network = "proxy"; + volumes = [ + "%h/containers/immich/upload:/usr/src/app/upload" + "/etc/localtime:/etc/localtime:ro" + ]; + extraConfig = { + Unit = { + After = [ + "podman-immich-redis.service" + "podman-immich-database.service" + ]; + Requires = [ + "podman-immich-redis.service" + "podman-immich-database.service" + ]; + }; + }; + environment = { + DB_PASSWORD = "changeme"; + DB_USERNAME = "postgres"; + DB_DATABASE_NAME = "immich"; + DB_HOSTNAME = "immich-database"; + REDIS_HOSTNAME = "immich-redis"; + }; + }; + + services.podman.containers.immich-machine-learning = { + image = "ghcr.io/immich-app/immich-machine-learning:release"; + network = "proxy"; + volumes = [ + "%h/containers/immich/model-cache:/cache" + ]; + }; + + services.podman.containers.immich-redis = { + image = "docker.io/valkey/valkey:8-bookworm@sha256:42cba146593a5ea9a622002c1b7cba5da7be248650cbb64ecb9c6c33d29794b1"; + network = "proxy"; + }; + + services.podman.containers.immich-database = { + image = "docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:739cdd626151ff1f796dc95a6591b55a714f341c737e27f045019ceabf8e8c52"; + network = "proxy"; + volumes = [ + "%h/containers/immich/database-data:/var/lib/postgresql/data" + ]; + environment = { + POSTGRES_PASSWORD = "changeme"; + POSTGRES_USER = "postgres"; + POSTGRES_DB = "immich"; + POSTGRES_INITDB_ARGS = "--data-checksums"; + }; + exec = ''postgres -c shared_preload_libraries=vectors.so -c 'search_path="$$user", public, vectors' -c logging_collector=on -c max_wal_size=2GB -c shared_buffers=512MB -c wal_compression=on''; + }; + }; +} diff --git a/modules/home/containers/uptime-kuma.nix b/modules/home/containers/uptime-kuma.nix new file mode 100644 index 0000000..7ff72c9 --- /dev/null +++ b/modules/home/containers/uptime-kuma.nix @@ -0,0 +1,27 @@ +{ config, lib, ... }: + +with lib; + +let + cfg = config.settings.containers.uptime-kuma; +in { + options = { + settings.containers.uptime-kuma.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enable uptime kuma container + ''; + }; + }; + + config = mkIf cfg.enable { + services.podman.containers.uptime-kuma = { + image = "louislam/uptime-kuma:1"; + network = "proxy"; + volumes = [ + "%h/containers/uptime-kuma/data:/app/data" + ]; + }; + }; +} diff --git a/modules/home/default.nix b/modules/home/default.nix index 4e623b1..8436fb2 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -28,5 +28,8 @@ ./containers/kanidm.nix ./containers/nginx.nix ./containers/forgejo.nix + ./containers/immich.nix + ./containers/homepage.nix + ./containers/uptime-kuma.nix ]; }