1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-30 18:38:31 +02:00
home-manager/modules/programs/yt-dlp.nix

48 lines
1.1 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.yt-dlp;
in {
meta.maintainers = [ maintainers.marsam ];
options.programs.yt-dlp = {
enable = mkEnableOption "yt-dlp";
package = mkOption {
type = types.package;
default = pkgs.yt-dlp;
defaultText = literalExpression "pkgs.yt-dlp";
description = "Package providing the <command>yt-dlp</command> tool.";
};
extraConfig = mkOption {
type = types.lines;
default = "";
example = literalExpression ''
--embed-thumbnail
--embed-subs
--sub-langs all
--downloader aria2c
--downloader-args aria2c:'-c -x8 -s8 -k1M'
'';
description = ''
Configuration written to
<filename>$XDG_CONFIG_HOME/yt-dlp/config</filename>. See
<link xlink:href="https://github.com/yt-dlp/yt-dlp#configuration" />
for explanation about possible values.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
xdg.configFile."yt-dlp/config" =
mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; };
};
}