yt-dlp: add module

yt-dlp is a cli to download videos from YouTube.com and other sites.
This commit is contained in:
Mario Rodas 2022-07-09 04:20:00 +00:00 committed by Robert Helgesson
parent 6ec6b2e362
commit 4cfc0a1e02
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 57 additions and 0 deletions

2
.github/CODEOWNERS vendored
View file

@ -310,6 +310,8 @@ Makefile @thiagokokada
/modules/programs/xmobar.nix @t4ccer
/tests/modules/programs/xmobar @t4ccer
/modules/programs/yt-dlp.nix @marsam
/modules/programs/z-lua.nix @marsam
/modules/programs/zathura.nix @rprospero

View file

@ -682,6 +682,13 @@ in
A new module is available: 'programs.nheko'.
'';
}
{
time = "2022-09-08T17:50:43+00:00";
message = ''
A new module is available: 'programs.yt-dlp'.
'';
}
];
};
}

View file

@ -180,6 +180,7 @@ let
./programs/waybar.nix
./programs/wezterm.nix
./programs/xmobar.nix
./programs/yt-dlp.nix
./programs/z-lua.nix
./programs/zathura.nix
./programs/zellij.nix

View file

@ -0,0 +1,47 @@
{ 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; };
};
}