1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01: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:
Matthieu Coudron 2025-02-04 12:07:35 +01:00 committed by GitHub
parent 066ba0c5cf
commit 7abcf59a36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 0 deletions

View file

@ -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 { profiles = mkOption {
description = '' description = ''
Sub-configuration options for specific profiles written to Sub-configuration options for specific profiles written to
@ -207,6 +220,14 @@ in {
home.packages = [ mpvPackage ]; home.packages = [ mpvPackage ];
programs.mpv.finalPackage = 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 != { }) { (mkIf (cfg.config != { } || cfg.profiles != { }) {
xdg.configFile."mpv/mpv.conf".text = '' xdg.configFile."mpv/mpv.conf".text = ''
${optionalString (cfg.defaultProfiles != [ ]) ${optionalString (cfg.defaultProfiles != [ ])

View file

@ -11,3 +11,5 @@ vo=%5%vdpau
alang=%2%en alang=%2%en
profile-desc=%26%profile for dvd:// streams profile-desc=%26%profile for dvd:// streams
include=manual.conf

View file

@ -16,6 +16,8 @@
# script-binding uosc/video #! Video tracks # script-binding uosc/video #! Video tracks
''; '';
includes = [ "manual.conf" ];
config = { config = {
force-window = true; force-window = true;
ytdl-format = "bestvideo+bestaudio"; ytdl-format = "bestvideo+bestaudio";