mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-12 01:59:37 +08:00
mpv: support includes directives (#6391)
to allow mixing imperative and declarative config the includes are at the end of the config
This commit is contained in:
@@ -130,6 +130,19 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
includes = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = literalExpression ''
|
||||
[
|
||||
"~/path/to/config.inc";
|
||||
"~/path/to/conditional.inc";
|
||||
]
|
||||
'';
|
||||
description =
|
||||
"List of configuration files to include at the end of mpv.conf.";
|
||||
};
|
||||
|
||||
profiles = mkOption {
|
||||
description = ''
|
||||
Sub-configuration options for specific profiles written to
|
||||
@@ -207,6 +220,14 @@ in {
|
||||
home.packages = [ mpvPackage ];
|
||||
programs.mpv.finalPackage = mpvPackage;
|
||||
}
|
||||
|
||||
(mkIf (cfg.includes != [ ]) {
|
||||
xdg.configFile."mpv/mpv.conf" = {
|
||||
text = lib.mkAfter
|
||||
(concatMapStringsSep "\n" (x: "include=${x}") cfg.includes);
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf (cfg.config != { } || cfg.profiles != { }) {
|
||||
xdg.configFile."mpv/mpv.conf".text = ''
|
||||
${optionalString (cfg.defaultProfiles != [ ])
|
||||
|
||||
@@ -11,3 +11,5 @@ vo=%5%vdpau
|
||||
alang=%2%en
|
||||
profile-desc=%26%profile for dvd:// streams
|
||||
|
||||
|
||||
include=manual.conf
|
||||
@@ -16,6 +16,8 @@
|
||||
# script-binding uosc/video #! Video tracks
|
||||
'';
|
||||
|
||||
includes = [ "manual.conf" ];
|
||||
|
||||
config = {
|
||||
force-window = true;
|
||||
ytdl-format = "bestvideo+bestaudio";
|
||||
|
||||
Reference in New Issue
Block a user