diff --git a/modules/services/jellyfin.nix b/modules/services/jellyfin.nix index 159634a..3dc13d4 100644 --- a/modules/services/jellyfin.nix +++ b/modules/services/jellyfin.nix @@ -32,6 +32,12 @@ in default = null; }; + debug = lib.mkOption { + description = "Enable debug logging"; + type = types.bool; + default = false; + }; + ldap = lib.mkOption { description = "LDAP configuration."; default = {}; @@ -419,8 +425,29 @@ in true ''; + + debugLogging = pkgs.writeText "debugLogging.json" '' + { + "Serilog": { + "MinimumLevel": { + "Default": "Debug", + "Override": { + "": "Debug" + } + } + } + } + ''; in - lib.strings.optionalString cfg.ldap.enable (shblib.replaceSecretsScript { + lib.strings.optionalString cfg.debug + '' + if [ -f "${config.services.jellyfin.configDir}/logging.json" ] && [ ! -L "${config.services.jellyfin.configDir}/logging.json" ]; then + echo "A ${config.services.jellyfin.configDir}/logging.json file exists already, this indicates probably an existing installation. Please remove it before continuing." + exit 1 + fi + ln -fs "${debugLogging}" "${config.services.jellyfin.configDir}/logging.json" + '' + + lib.strings.optionalString cfg.ldap.enable (shblib.replaceSecretsScript { file = ldapConfig; resultPath = "/var/lib/jellyfin/plugins/configurations/LDAP-Auth.xml"; replacements = [ diff --git a/test/services/jellyfin.nix b/test/services/jellyfin.nix index ab83c5b..3315ea1 100644 --- a/test/services/jellyfin.nix +++ b/test/services/jellyfin.nix @@ -24,6 +24,7 @@ let shb.jellyfin = { enable = true; inherit (config.test) subdomain domain; + debug = true; }; };