1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-17 16:49:45 +01:00
home-manager/modules/programs/yt-dlp.nix
Mario Rodas 4cfc0a1e02
yt-dlp: add module
yt-dlp is a cli to download videos from YouTube.com and other sites.
2022-09-08 19:51:24 +02:00

47 lines
1.1 KiB
Nix

{ 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; };
};
}