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.
This commit is contained in:
YTG1234 2025-05-31 22:16:04 +03:00 committed by Austin Horstman
parent 09b0a4b0da
commit 7707ebb05c

View file

@ -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) {