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;
homepage-dashboard.enable = true;
immich.enable = true;
jellyfin.enable = true;
jitsi.enable = true;
paperless.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} = {
enable = mkEnableOption "Enable ${service}";
services.jellyfin = {
enable = true;
url = mkOption {
default = "${service}.${homelab.domain}";
type = types.str;
};
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;
};
configDir = "/mnt/media/jellyfin";
group = "media";
openFirewall = true;
};
config = mkIf cfg.enable {
services = {
${service} = {
enable = true;
services.nginx.virtualHosts."jellyfin.oliverdavies.uk" = {
forceSSL = true;
useACMEHost = "oliverdavies.uk";
configDir = "/mnt/media/${service}";
group = "media";
openFirewall = true;
};
locations."/" = {
proxyPass = "http://localhost:8096";
recommendedProxySettings = true;
nginx.virtualHosts."${cfg.url}" = {
forceSSL = true;
useACMEHost = homelab.domain;
locations."/" = {
proxyPass = "http://localhost:8096";
recommendedProxySettings = true;
extraConfig = ''
proxy_buffering off;
'';
};
};
extraConfig = ''
proxy_buffering off;
'';
};
};
}