Refactor Immich configuration
All checks were successful
/ check (push) Successful in 1m29s

This commit is contained in:
Oliver Davies 2025-06-24 18:14:16 +01:00
parent 88781bae05
commit f0f757ea77
2 changed files with 18 additions and 64 deletions

View file

@ -11,7 +11,6 @@
gitea-actions-runner.enable = true;
home-assistant.enable = true;
homepage-dashboard.enable = true;
immich.enable = true;
jitsi.enable = true;
paperless.enable = true;
peertube.enable = true;

View file

@ -1,58 +1,15 @@
{ config, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = homelab.services.${service};
homelab = config.homelab;
service = "immich";
in
{
options.homelab.services.${service} = {
enable = mkEnableOption "Enable ${service}";
url = mkOption {
default = "photos.${homelab.domain}";
type = types.str;
};
homepage.name = mkOption {
default = "Immich";
type = types.str;
};
homepage.description = mkOption {
default = "Self-hosted photo and video management solution";
type = types.str;
};
homepage.icon = mkOption {
default = "immich";
type = types.str;
};
homepage.category = mkOption {
default = "Media";
type = types.str;
};
};
config = mkIf cfg.enable {
services = {
${service} = {
services.immich = {
enable = true;
group = "media";
mediaLocation = "/mnt/media/${service}";
mediaLocation = "/mnt/media/immich";
};
nginx.virtualHosts."${cfg.url}" = {
services.nginx.virtualHosts."photos.oliverdavies.uk" = {
forceSSL = true;
useACMEHost = homelab.domain;
useACMEHost = "oliverdavies.uk";
locations."/" = {
proxyPass = "http://localhost:${toString config.services.immich.port}";
@ -60,11 +17,9 @@ in
recommendedProxySettings = true;
};
};
};
environment.systemPackages = with pkgs; [
immich-cli
immich-go
];
};
}