Refactor jellyfin configuration

This commit is contained in:
Oliver Davies 2025-06-24 00:35:30 +01:00
parent d25628813b
commit 1ea1cc02bb
2 changed files with 14 additions and 57 deletions

View file

@ -13,7 +13,6 @@
home-assistant.enable = true; home-assistant.enable = true;
homepage-dashboard.enable = true; homepage-dashboard.enable = true;
immich.enable = true; immich.enable = true;
jellyfin.enable = true;
jitsi.enable = true; jitsi.enable = true;
paperless.enable = true; paperless.enable = true;
peertube.enable = true; peertube.enable = true;

View file

@ -1,65 +1,23 @@
{ config, lib, ... }:
with lib;
let
cfg = homelab.services.${service};
homelab = config.homelab;
service = "jellyfin";
in
{ {
options.homelab.services.${service} = { services.jellyfin = {
enable = mkEnableOption "Enable ${service}"; enable = true;
url = mkOption { configDir = "/mnt/media/jellyfin";
default = "${service}.${homelab.domain}"; group = "media";
type = types.str; openFirewall = true;
};
homepage.name = mkOption {
default = "Jellyfin";
type = types.str;
};
homepage.description = mkOption {
default = "The Free Software Media System";
type = types.str;
};
homepage.icon = mkOption {
default = "jellyfin";
type = types.str;
};
homepage.category = mkOption {
default = "Media";
type = types.str;
};
}; };
config = mkIf cfg.enable { services.nginx.virtualHosts."jellyfin.oliverdavies.uk" = {
services = { forceSSL = true;
${service} = { useACMEHost = "oliverdavies.uk";
enable = true;
configDir = "/mnt/media/${service}"; locations."/" = {
group = "media"; proxyPass = "http://localhost:8096";
openFirewall = true; recommendedProxySettings = true;
};
nginx.virtualHosts."${cfg.url}" = { extraConfig = ''
forceSSL = true; proxy_buffering off;
useACMEHost = homelab.domain; '';
locations."/" = {
proxyPass = "http://localhost:8096";
recommendedProxySettings = true;
extraConfig = ''
proxy_buffering off;
'';
};
};
}; };
}; };
} }