niksos/modules/gui/mpv.nix

46 lines
1.2 KiB
Nix

{
config,
lib,
pkgs,
...
}: let
cfg = config.myOptions.programs.mpv;
inherit (config.myOptions.other.system) username;
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption 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
];
};
};
};
}