nix-config/hosts/nixedo/modules/immich.nix

71 lines
1.3 KiB
Nix
Raw Normal View History

2025-04-28 01:58:11 +01:00
{
config,
lib,
pkgs,
...
}:
with lib;
2024-12-10 21:40:33 +00:00
2025-04-28 01:58:11 +01:00
let
2025-04-30 01:10:02 +01:00
cfg = homelab.services.${service};
homelab = config.features.homelab;
2025-04-30 01:10:02 +01:00
service = "immich";
2025-04-28 01:58:11 +01:00
in
2024-11-26 08:40:00 +00:00
{
options.features.homelab.services.${service} = {
2025-04-30 01:10:02 +01:00
enable = mkEnableOption "Enable ${service}";
url = mkOption {
default = "photos.${homelab.baseDomain}";
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;
};
2025-04-28 01:58:11 +01:00
};
2024-11-26 08:40:00 +00:00
2025-04-28 01:58:11 +01:00
config = mkIf cfg.enable {
services = {
2025-04-30 01:10:02 +01:00
${service} = {
2025-04-28 01:58:11 +01:00
enable = true;
group = "media";
2025-04-30 01:10:02 +01:00
mediaLocation = "/mnt/media/${service}";
2025-04-28 01:58:11 +01:00
};
2025-04-30 01:10:02 +01:00
nginx.virtualHosts."${cfg.url}" = {
2025-04-28 01:58:11 +01:00
forceSSL = true;
2025-04-30 01:10:02 +01:00
useACMEHost = homelab.baseDomain;
2025-04-28 01:58:11 +01:00
locations."/" = {
proxyPass = "http://localhost:${toString config.services.immich.port}";
2025-04-28 07:42:06 +01:00
proxyWebsockets = true;
2025-04-28 01:58:11 +01:00
recommendedProxySettings = true;
};
};
};
2025-04-19 11:45:23 +01:00
2025-04-28 01:58:11 +01:00
environment.systemPackages = with pkgs; [
immich-cli
immich-go
];
};
2024-11-26 08:40:00 +00:00
}