NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.35k stars 13.59k forks source link

mpv: system-wide config is in Nix store #329258

Open 0n-s opened 1 month ago

0n-s commented 1 month ago

Describe the bug

mpv cannot be configured systemwide with /etc/mpv/mpv.conf. The default build configuration (see FILES section in mpv(1) manpage) leads mpv to look into the Nix store for /etc/mpv/mpv.conf (e.g. /nix/store/08a907bw4csdc44408a992lnc9v2802c-mpv-0.38.0/etc/mpv/mpv.conf).

Steps To Reproduce

Steps to reproduce the behavior:

  1. Make /etc/mpv/mpv.conf with some config values, like speed=3.
  2. Nothing changes.

Expected behavior

mpv should look in /etc/mpv for configuration, not in the Nix store.

Notify maintainers

@AndersonTorres @fpletz @globin @ma27

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.10.0, NixOS, 24.11 (Vicuna), 24.11pre655136.1d9c2c9b3e71`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.5`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a :+1: reaction to issues you find important.

AndersonTorres commented 1 month ago

From the source code of mpv:

https://github.com/mpv-player/mpv/blob/06470899dfd73069ee439ebe71b5c132de8fe54d/etc/mpv.conf#L10-L14

# Configuration files are read system-wide from /usr/local/etc/mpv.conf
# and per-user from ~/.config/mpv/mpv.conf, where per-user settings override
# system-wide settings, all of which are overridden by the command line.

I suspect it will not be possible from our side.

0n-s commented 1 month ago

That is just the default path. Even NixOS's mpv package doesn't use that (again, see FILES section in mpv's manpage).

The real issue is that mpv's build wants the system config directory to be writable so it can install its encoding-profiles.conf file. That's really all it is, I believe. So I think it can be approached by just patching the build script to not install to that directory & instead installing encoding-profiles.conf ourselves with something in /etc/static.

EDIT: or alternatively convince mpv developers to bake that file into their binary? They already do it with their input.conf

AndersonTorres commented 1 month ago

I vote for working this with upstream, since such modification can be useful for other distros.