{ config, lib, pkgs, ... }: let cfg = config.myOptions.programs.mpv; inherit (config.myOptions.other.system) username; inherit (lib) mkEnableOption mkIf mkOption; inherit (lib.types) nullOr str; in { options.myOptions.programs.mpv = { enable = mkEnableOption "mpv"; gpu = mkOption { description = "gpu used to render videos played through mpv"; type = nullOr str; default = null; }; }; config = mkIf cfg.enable { home-manager.users.${username} = { programs.mpv = { enable = true; config = { vo = "gpu-next"; hwdec = "auto"; gpu-api = "vulkan"; vulkan-device = mkIf (cfg.gpu != null) cfg.gpu; volume = 50; osc = "no"; osd-bar = "no"; border = "no"; }; scripts = with pkgs.mpvScripts; [ mpris thumbfast sponsorblock uosc ]; }; }; }; }