diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index d549169a9..695b37d9f 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -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
diff --git a/modules/misc/news.nix b/modules/misc/news.nix
index 882cd8fed..4e5ee7724 100644
--- a/modules/misc/news.nix
+++ b/modules/misc/news.nix
@@ -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'.
+ '';
+ }
];
};
}
diff --git a/modules/modules.nix b/modules/modules.nix
index 61f5436b6..6c7fb5bf5 100644
--- a/modules/modules.nix
+++ b/modules/modules.nix
@@ -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
diff --git a/modules/programs/yt-dlp.nix b/modules/programs/yt-dlp.nix
new file mode 100644
index 000000000..19e9c7e05
--- /dev/null
+++ b/modules/programs/yt-dlp.nix
@@ -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 yt-dlp 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
+ $XDG_CONFIG_HOME/yt-dlp/config. See
+
+ for explanation about possible values.
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ home.packages = [ cfg.package ];
+
+ xdg.configFile."yt-dlp/config" =
+ mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; };
+ };
+}