feat(mpv): hardware decode with per-host hwdec

mpv shipped as a bare package with no config, so every host decoded video
in software. hwdec is the only vendor-specific part, so it is an option:
auto-safe everywhere, overridden on NVIDIA hosts.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Miguel Palhas
2026-08-24 12:13:38 +01:00
parent 0d2a4cb86f
commit 3d372cd155
2 changed files with 41 additions and 2 deletions
+5 -2
View File
@@ -4,14 +4,17 @@
... ...
}: }:
{ {
imports = [ ./darkman.nix ]; imports = [
./darkman.nix
# mpv is installed by programs.mpv there, not as a bare package here.
../mpv.nix
];
home = { home = {
packages = with pkgs; [ packages = with pkgs; [
# various # various
google-chrome google-chrome
thunar thunar
mpv
imv imv
pavucontrol pavucontrol
zathura zathura
+36
View File
@@ -0,0 +1,36 @@
{
config,
lib,
...
}:
let
cfg = config.custom.mpv;
in
{
options.custom.mpv = {
hwdec = lib.mkOption {
type = lib.types.str;
default = "auto-safe";
example = "nvdec-copy";
description = ''
Value for mpv's `hwdec`. `auto-safe` only picks a decoder mpv considers
reliable for the running driver and falls back to software otherwise,
so it is correct on Intel (arrakis) and on hosts with no usable GPU
decoder (yolo). NVIDIA hosts override it.
'';
};
};
config = {
programs.mpv = {
enable = true;
config = {
hwdec = cfg.hwdec;
vo = lib.mkDefault "gpu-next";
save-position-on-quit = true;
keep-open = "yes";
};
};
};
}