diff --git a/configs/fwbook/omarchy/shell.json b/configs/fwbook/omarchy/shell.json index dc63a43..049d85e 100644 --- a/configs/fwbook/omarchy/shell.json +++ b/configs/fwbook/omarchy/shell.json @@ -55,7 +55,7 @@ ] }, "position": "top", - "transparent": true + "transparent": false }, "idle": { "lock": 300, diff --git a/flake.nix b/flake.nix index 510f1c4..ea87847 100644 --- a/flake.nix +++ b/flake.nix @@ -172,6 +172,7 @@ buildbot-gitea-token = ./secrets/buildbot-gitea-token.age; buildbot-gitea-webhook-secret = ./secrets/buildbot-gitea-webhook-secret.age; buildbot-gitea-oauth-secret = ./secrets/buildbot-gitea-oauth-secret.age; + immich-shared = ./secrets/immich-shared.age; }; inherit hyprlauncher diff --git a/hosts/ABOUTME.md b/hosts/ABOUTME.md index 5040d29..4ea60cd 100644 --- a/hosts/ABOUTME.md +++ b/hosts/ABOUTME.md @@ -34,7 +34,7 @@ hosts/ | `hl-fwdesk/` | hl-fwdesk | Framework Desktop AI Max 300 — AI workstation; buildbot-nix CI worker (4 cores) | | `hl-fws1/` | hl-fws1 | Framework 11th Intel — K3s server node | | `hl-bigbox1/` | hl-bigbox1 | AI/compute server (NVIDIA + AMD) | -| `hl-bigbox2/` | hl-bigbox2 | NFS storage server | +| `hl-bigbox2/` | hl-bigbox2 | NFS storage server; Immich (docker, `immich.home.sosnovsky.ca`) | | `hl-minipc1/` | hl-minipc1 | Core infra: Gitea (native or containerized), nix-serve, registry, Buzz (docker, `buzz-manage` CLI) | | `hl-minipc2/` | hl-minipc2 | Container/media server | | `hl-minipc3/` | hl-minipc3 | K3s worker node; central Caddy reverse-proxy (`*.home.sosnovsky.ca`, plus `gitea.skyg.ca` HTTP/SSH); buildbot-nix CI master + worker (2 cores) | diff --git a/hosts/hl-bigbox2/default.nix b/hosts/hl-bigbox2/default.nix index a120950..9d187a3 100644 --- a/hosts/hl-bigbox2/default.nix +++ b/hosts/hl-bigbox2/default.nix @@ -1,16 +1,7 @@ -{ config, lib, pkgs, ... }: -let - ports = { - nixServe = 5000; - lockdPort = 4001; - mountdPort = 4002; - statdPort = 4000; - }; - openPorts = builtins.attrValues ports; -in +{ lib, ... }: { imports = [ - ./services.nix + ./services ./hardware-configuration ./hardware.nix ]; @@ -23,6 +14,11 @@ in nixos.common = { ssh-server.enable = true; containers.openMetricsPort = true; + containers.networks.ipvlanLab = { + enable = true; + parent = "enp3s0"; + }; + cachePush.enable = false; }; server.exporters.enable = true; networkDrives = { @@ -30,6 +26,4 @@ in bigBox2.enable = false; }; }; - - skyg.nixos.common.cachePush.enable = false; } diff --git a/hosts/hl-bigbox2/services/default.nix b/hosts/hl-bigbox2/services/default.nix new file mode 100644 index 0000000..d171421 --- /dev/null +++ b/hosts/hl-bigbox2/services/default.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + imports = [ + ./nix-serve.nix + ./nfs-server.nix + ./immich.nix + ]; +} diff --git a/hosts/hl-bigbox2/services/immich.nix b/hosts/hl-bigbox2/services/immich.nix new file mode 100644 index 0000000..f038e93 --- /dev/null +++ b/hosts/hl-bigbox2/services/immich.nix @@ -0,0 +1,86 @@ +{ config, skygUtils, skyg-secrets, ... }: +let + version = "v3"; + app = config.skyg.internalNetworkingMap.apps.immich; + envVars = { + REDIS_PORT = "6379"; + REDIS_HOSTNAME = "redis"; + DB_HOSTNAME = "database"; + + DB_USERNAME = "immich"; + POSTGRES_USER = "immich"; + POSTGRES_DB = "immich"; + DB_DATABASE_NAME = "immich"; + }; + nfsVolume = skygUtils.container-services.nfs.tnas1; +in +{ + age.secrets.immich-shared.file = skyg-secrets.immich-shared; + + skyg.nixos.common.container-services.immich = { + enable = true; + autoUpdate.enable = true; + networks = { + main = { driver = "bridge"; }; + lan = config.skyg.nixos.common.containers.networks.ipvlanLab.compose; + }; + volumes = { + family-storage = nfsVolume "/mnt/EightTerra/FamilyStorage"; + model-cache = { }; + }; + services.immich-server = { + image = "ghcr.io/immich-app/immich-server:${version}"; + environmentFiles = [ config.age.secrets.immich-shared.path ]; + environment = envVars; + networks = { + lan.ipv4_address = app.ip; + main = { }; + }; + volumes = [ + "/data/fourTerra/immich-upload:/usr/src/app/upload" + "family-storage:/family-storage" + ]; + extraConfig.depends_on = { + database.condition = "service_healthy"; + redis.condition = "service_healthy"; + }; + restart = "always"; + }; + services.immich-machine-learning = { + image = "ghcr.io/immich-app/immich-machine-learning:${version}"; + environmentFiles = [ config.age.secrets.immich-shared.path ]; + environment = envVars; + networks.main = { }; + volumes = [ "model-cache:/cache" ]; + restart = "always"; + }; + services.redis = { + image = "docker.io/valkey/valkey:9@sha256:c123e3715db63d06d4ad6964884037aa0d5d4d703939b9929954112889708e1d"; + networks.main = { }; + healthcheck = { + test = [ "CMD-SHELL" "redis-cli ping || exit 1" ]; + interval = "30s"; + timeout = "5s"; + retries = 5; + start_period = "10s"; + }; + restart = "always"; + }; + services.database = { + image = "ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:bcf63357191b76a916ae5eb93464d65c07511da41e3bf7a8416db519b40b1c23"; + environmentFiles = [ config.age.secrets.immich-shared.path ]; + environment.POSTGRES_INITDB_ARGS = "--data-checksums"; + networks.main = { }; + volumes = [ "/data/fourTerra/immich-db:/var/lib/postgresql/data" ]; + healthcheck = { + test = [ "CMD-SHELL" ''pg_isready --dbname="$$POSTGRES_DB" --username="$$POSTGRES_USER" || exit 1'' ]; + interval = "5m"; + timeout = "10s"; + retries = 5; + start_period = "5m"; + start_interval = "30s"; + }; + restart = "always"; + }; + }; +} diff --git a/hosts/hl-bigbox2/services.nix b/hosts/hl-bigbox2/services/nfs-server.nix similarity index 79% rename from hosts/hl-bigbox2/services.nix rename to hosts/hl-bigbox2/services/nfs-server.nix index 2a22629..dea14b8 100644 --- a/hosts/hl-bigbox2/services.nix +++ b/hosts/hl-bigbox2/services/nfs-server.nix @@ -1,7 +1,6 @@ { ... }: let ports = { - nixServe = 5000; lockdPort = 4001; mountdPort = 4002; statdPort = 4000; @@ -9,12 +8,6 @@ let openPorts = builtins.attrValues ports; in { - services.nix-serve = { - enable = true; - secretKeyFile = "/home/ari/cache-keys/cache-priv-key.pem"; - port = ports.nixServe; - }; - skyg.nixos.common.networking.nfsServer.enable = true; services.nfs.server = { lockdPort = ports.lockdPort; diff --git a/hosts/hl-bigbox2/services/nix-serve.nix b/hosts/hl-bigbox2/services/nix-serve.nix new file mode 100644 index 0000000..fffa631 --- /dev/null +++ b/hosts/hl-bigbox2/services/nix-serve.nix @@ -0,0 +1,16 @@ +{ ... }: +let + ports = { + nixServe = 5000; + }; + openPorts = builtins.attrValues ports; +in +{ + services.nix-serve = { + enable = true; + secretKeyFile = "/home/ari/cache-keys/cache-priv-key.pem"; + port = ports.nixServe; + }; + networking.firewall.allowedUDPPorts = openPorts; + networking.firewall.allowedTCPPorts = openPorts; +} diff --git a/hosts/hl-minipc1/services/buzz.nix b/hosts/hl-minipc1/services/buzz.nix index d540ced..91c5087 100644 --- a/hosts/hl-minipc1/services/buzz.nix +++ b/hosts/hl-minipc1/services/buzz.nix @@ -1,12 +1,6 @@ -{ config, ... }: +{ config, skygUtils, ... }: let - nfsVolume = exportPath: { - driver_opts = { - type = "nfs"; - o = "addr=tnas1.lab.internal,rw,nfsvers=4.0,nolock,hard,noatime"; - device = ":${exportPath}"; - }; - }; + nfsVolume = skygUtils.container-services.nfs.tnas1; app = config.skyg.internalNetworkingMap.apps.buzz; buzz = { domain = app.effectiveDns; diff --git a/hosts/hl-minipc3/services/caddy.nix b/hosts/hl-minipc3/services/caddy.nix index 9335146..7c5dd2d 100644 --- a/hosts/hl-minipc3/services/caddy.nix +++ b/hosts/hl-minipc3/services/caddy.nix @@ -3,6 +3,7 @@ let app = config.skyg.internalNetworkingMap.apps.caddy; nvr = config.skyg.internalNetworkingMap.apps.nvr; jellyfin = config.skyg.internalNetworkingMap.apps.jellyfin; + immich = config.skyg.internalNetworkingMap.apps.immich; portainer = config.skyg.internalNetworkingMap.apps.portainer; publicGitea = config.skyg.internalNetworkingMap.apps.public-gitea; certDomain = "home.sosnovsky.ca"; @@ -36,6 +37,10 @@ in tls /etc/caddy/tls/fullchain.pem /etc/caddy/tls/key.pem reverse_proxy bigbox1.lab.internal:8096 } + immich.home.sosnovsky.ca { + tls /etc/caddy/tls/fullchain.pem /etc/caddy/tls/key.pem + reverse_proxy ${immich.ip}:2283 + } portainer.home.sosnovsky.ca { tls /etc/caddy/tls/fullchain.pem /etc/caddy/tls/key.pem reverse_proxy ${portainer.ip}:9000 diff --git a/modules/main.nix b/modules/main.nix index 06828e6..345420d 100644 --- a/modules/main.nix +++ b/modules/main.nix @@ -109,6 +109,7 @@ in audiobooks = { ip = "10.0.101.4"; }; gitea = { ip = "10.0.101.8"; }; public-gitea = { ip = "10.0.101.9"; }; + immich = { ip = "10.0.101.10"; }; jellyfin = { ip = "10.0.101.5"; }; nvr = { ip = "10.0.101.6"; }; portainer = { ip = "10.0.101.241"; }; @@ -118,6 +119,7 @@ in "nvr.home.sosnovsky.ca" "jellyfin.home.sosnovsky.ca" "portainer.home.sosnovsky.ca" + "immich.home.sosnovsky.ca" "gitea.skyg.ca" ]; }; diff --git a/modules/nixos/desktop/tiler/niri.nix b/modules/nixos/desktop/tiler/niri.nix index e901551..04944aa 100644 --- a/modules/nixos/desktop/tiler/niri.nix +++ b/modules/nixos/desktop/tiler/niri.nix @@ -2,7 +2,6 @@ , lib , pkgs , skygUtils -, unstablePkgs , ... }: let diff --git a/modules/skyg-utils.nix b/modules/skyg-utils.nix index f42f5cb..15260a1 100644 --- a/modules/skyg-utils.nix +++ b/modules/skyg-utils.nix @@ -67,4 +67,18 @@ ''; }; }; + container-services = rec { + makeNfsVolumeFactory = host: exportPath: { + driver_opts = { + type = "nfs"; + o = "addr=${host},rw,nfsvers=4.0,nolock,hard,noatime"; + device = ":${exportPath}"; + }; + }; + nfsVols = { + terra1 = makeNfsVolumeFactory "terra1.lab.internal"; + tnas1 = makeNfsVolumeFactory "tnas1.lab.internal"; + bigbox2 = makeNfsVolumeFactory "bigbox2.lab.internal"; + }; + }; } diff --git a/secrets.nix b/secrets.nix index 241e335..f5eae97 100644 --- a/secrets.nix +++ b/secrets.nix @@ -6,6 +6,7 @@ let terra1 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHBKI8gqd7DDubShle4D3JGq61BP1NBKCZ81V3C9uyym root@nixos"; fwdesk = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHbBcdMpNPaELUzHRIoRkTUQde+mBQ87Ra2R+974FuUy root@hl-fwdesk"; bigbox1 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFl5xiH4aFlmDWdoU+KmERLYOeOQK2aKP7jenY2G3rFb root@nixos"; + bigbox2 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL6l6VqQ23PkGkWVABBoLp1KA6PzkX5oKTy5RBHbQXet root@hl-bigbox2"; in { "secrets/dns-addresses.conf.age".publicKeys = [ @@ -49,4 +50,7 @@ in "secrets/buildbot-gitea-token.age".publicKeys = [ ari minipc3 ]; "secrets/buildbot-gitea-webhook-secret.age".publicKeys = [ ari minipc3 ]; "secrets/buildbot-gitea-oauth-secret.age".publicKeys = [ ari minipc3 ]; + + # immich + "secrets/immich-shared.age".publicKeys = [ ari bigbox2 ]; } diff --git a/secrets/glmain.json.age b/secrets/glmain.json.age index f507ea4..68b7f1a 100644 Binary files a/secrets/glmain.json.age and b/secrets/glmain.json.age differ diff --git a/secrets/immich-shared.age b/secrets/immich-shared.age new file mode 100644 index 0000000..84d12aa Binary files /dev/null and b/secrets/immich-shared.age differ