From 7707ebb05c6a021e730fdefdb41c2b7e8133251d Mon Sep 17 00:00:00 2001 From: YTG1234 Date: Sat, 31 May 2025 22:16:04 +0300 Subject: [PATCH] jellyfin-mpv-shim: make sure the config file is read properly jellyfin-mpv-shim has a bug, that causes it to not be able to read the configuration file if it's not writeable (even though it never writes anything). This commit works around that by storing the actual link to the Nix store in a different file, and making a writable copy in `conf.json`. Ideally, this should be fixed either with a patch in nixpkgs or (even better) upstream. --- modules/services/jellyfin-mpv-shim.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/services/jellyfin-mpv-shim.nix b/modules/services/jellyfin-mpv-shim.nix index dd4fc5f1..037750d9 100644 --- a/modules/services/jellyfin-mpv-shim.nix +++ b/modules/services/jellyfin-mpv-shim.nix @@ -107,8 +107,20 @@ in ]; xdg.configFile = { + # jellyfin-mpv-shim errors if the config file isn't writeable + # so, as a temporary workaround, we generate a hidden file (.conf.json) + # and make a writeable copy. "jellyfin-mpv-shim/conf.json" = lib.mkIf (cfg.settings != { }) { source = jsonFormat.generate "jellyfin-mpv-shim-conf" cfg.settings; + target = "jellyfin-mpv-shim/.conf.json"; + onChange = + let + dir = "${config.xdg.configHome}/jellyfin-mpv-shim"; + in + '' + cp --dereference ${dir}/.conf.json ${dir}/conf.json + chmod u+w ${dir}/conf.json + ''; }; "jellyfin-mpv-shim/mpv.conf" = lib.mkIf (cfg.mpvConfig != null) {