From 4cfc0a1e02c6374f66acdfd2ff8ae3e87c80c818 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sat, 9 Jul 2022 04:20:00 +0000 Subject: [PATCH] yt-dlp: add module yt-dlp is a cli to download videos from YouTube.com and other sites. --- .github/CODEOWNERS | 2 ++ modules/misc/news.nix | 7 ++++++ modules/modules.nix | 1 + modules/programs/yt-dlp.nix | 47 +++++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 modules/programs/yt-dlp.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d549169a..695b37d9 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 882cd8fe..4e5ee772 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 61f5436b..6c7fb5bf 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 00000000..19e9c7e0 --- /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; }; + }; +}