mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
mpv: add defaultProfiles option
This commit is contained in:
parent
d62bdaf938
commit
65d0e2d241
1 changed files with 16 additions and 0 deletions
|
@ -12,6 +12,7 @@ let
|
||||||
mpvOptions = with types; attrsOf mpvOptionDup;
|
mpvOptions = with types; attrsOf mpvOptionDup;
|
||||||
mpvProfiles = with types; attrsOf mpvOptions;
|
mpvProfiles = with types; attrsOf mpvOptions;
|
||||||
mpvBindings = with types; attrsOf str;
|
mpvBindings = with types; attrsOf str;
|
||||||
|
mpvDefaultProfiles = with types; listOf str;
|
||||||
|
|
||||||
renderOption = option:
|
renderOption = option:
|
||||||
rec {
|
rec {
|
||||||
|
@ -45,6 +46,9 @@ let
|
||||||
concatStringsSep "\n"
|
concatStringsSep "\n"
|
||||||
(mapAttrsToList (name: value: "${name} ${value}") bindings);
|
(mapAttrsToList (name: value: "${name} ${value}") bindings);
|
||||||
|
|
||||||
|
renderDefaultProfiles = profiles:
|
||||||
|
renderOptions { profile = concatStringsSep "," profiles; };
|
||||||
|
|
||||||
mpvPackage = if cfg.scripts == [ ] then
|
mpvPackage = if cfg.scripts == [ ] then
|
||||||
pkgs.mpv
|
pkgs.mpv
|
||||||
else
|
else
|
||||||
|
@ -115,6 +119,16 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defaultProfiles = mkOption {
|
||||||
|
description = ''
|
||||||
|
Profiles to be applied by default. Options set by them are overridden
|
||||||
|
by options set in <xref linkend="opt-programs.mpv.config"/>.
|
||||||
|
'';
|
||||||
|
type = mpvDefaultProfiles;
|
||||||
|
default = [ ];
|
||||||
|
example = [ "gpu-hq" ];
|
||||||
|
};
|
||||||
|
|
||||||
bindings = mkOption {
|
bindings = mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
Input configuration written to
|
Input configuration written to
|
||||||
|
@ -145,6 +159,8 @@ in {
|
||||||
}
|
}
|
||||||
(mkIf (cfg.config != { } || cfg.profiles != { }) {
|
(mkIf (cfg.config != { } || cfg.profiles != { }) {
|
||||||
xdg.configFile."mpv/mpv.conf".text = ''
|
xdg.configFile."mpv/mpv.conf".text = ''
|
||||||
|
${optionalString (cfg.defaultProfiles != [ ])
|
||||||
|
(renderDefaultProfiles cfg.defaultProfiles)}
|
||||||
${optionalString (cfg.config != { }) (renderOptions cfg.config)}
|
${optionalString (cfg.config != { }) (renderOptions cfg.config)}
|
||||||
${optionalString (cfg.profiles != { }) (renderProfiles cfg.profiles)}
|
${optionalString (cfg.profiles != { }) (renderProfiles cfg.profiles)}
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in a new issue