nixos-config/users/simon/modules/youtube-dl.nix
2021-02-08 20:40:54 +01:00

27 lines
577 B
Nix

{ lib, pkgs, ... }:
let
formats = (lib.flatten
(lib.crossLists (x: y: [ "${x}+${y}" ])
[
[ "bestvideo[vcodec^=av01]" "bestvideo[vcodec^=vp9]" "bestvideo[vcodec^=avc1]" "bestvideo" ]
[ "bestaudio[acodec^=opus]" "bestaudio[acodec^=mp4a]" "bestaudio" ]
])) ++ [
"best"
];
options = {
format = lib.concatStringsSep "/" formats;
};
in
{
xdg.configFile."youtube-dl/config".text = lib.concatStringsSep
"\n"
(lib.mapAttrsToList
(k: v: "--${k} ${v}")
options);
home.packages = with pkgs; [
youtube-dl
];
}