mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
yt-dlp: generate config if settings or extraConfig are defined (#4018)
Previously, the config was generated only if settings were defined. In a case where settings weren't defined, extraConfig was ignored.
This commit is contained in:
parent
58eb968c21
commit
d1f04b0f36
4 changed files with 31 additions and 5 deletions
|
@ -66,9 +66,11 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = [ cfg.package ];
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
xdg.configFile."yt-dlp/config" = mkIf (cfg.settings != { }) {
|
xdg.configFile."yt-dlp/config" =
|
||||||
text = concatStringsSep "\n"
|
mkIf (cfg.settings != { } || cfg.extraConfig != "") {
|
||||||
(remove "" (renderSettings cfg.settings ++ [ cfg.extraConfig ])) + "\n";
|
text = concatStringsSep "\n"
|
||||||
};
|
(remove "" (renderSettings cfg.settings ++ [ cfg.extraConfig ]))
|
||||||
|
+ "\n";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
{ yt-dlp-simple-config = ./yt-dlp-simple-config.nix; }
|
{
|
||||||
|
yt-dlp-simple-config = ./yt-dlp-simple-config.nix;
|
||||||
|
yt-dlp-extraConfig = ./yt-dlp-extraConfig.nix;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
--config-locations /home/user/.yt-dlp.conf
|
||||||
|
|
19
tests/modules/programs/yt-dlp/yt-dlp-extraConfig.nix
Normal file
19
tests/modules/programs/yt-dlp/yt-dlp-extraConfig.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.yt-dlp = {
|
||||||
|
enable = true;
|
||||||
|
extraConfig = ''
|
||||||
|
--config-locations /home/user/.yt-dlp.conf
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
test.stubs.yt-dlp = { };
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/yt-dlp/config
|
||||||
|
assertFileContent home-files/.config/yt-dlp/config ${
|
||||||
|
./yt-dlp-extraConfig-expected
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue