Not sure about how to fix this mpv scripts bug

Trying to use uosc in mpv but having some font related issues.

Tldr: uosc needs two font files (uosc_icons.otf and uosc_textures.ttf) that it uses while modifying mpv's UI, but it cannot seem to find them.

Currently they are extracted to $out/share/fonts and the mpv wrapper is modified such that FONTCONFIG_FILE is set to a config file generated from that folder with makeFontsConf which does not appear to work. (Not that versed with fontconfig, but wouldn’t this approach mean that no other script can add their fonts as well should this have worked?)

Looking through mpv's documentation I cannot seem to find an equivalent to --script to load arbitrary fonts at runtime. There’s --sub-fonts-dir (subtitles) and --osd-fonts-dir (UI controls) in the master branch version, but they cannot be set to load from multiple folders.

mpv by default loads fonts from ~/.config/mpv/fonts/ and placing the files there does fix the issue, but I’m not sure about how to approach fixing this.

Possible methods include

  • The existence of a --script equivalent I somehow missed
  • Nullifying the effect of the font-dir options and setting it to some nix option controlled path
  • Using some nix magic by creating a global fontconfig file or a pseudo-folder with a derivation or similar which symlinks the font files + ~/.config/mpv/fonts + whatever the user originally inputted for that option.