aboutsummaryrefslogtreecommitdiff
path: root/.config/nixpkgs/packages/youtube-dl/default.nix
blob: 5a0ab1d5257fc0ffb2e0582600b6d58280a66199 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ lib, python39, ffmpeg, rtmpdump, phantomjs2, atomicparsley
, ffmpegSupport ? true, rtmpSupport ? true, phantomjsSupport ? false
, hlsEncryptedSupport ? true, withAlias ? true }:

with python39.pkgs;

buildPythonPackage rec {
  pname = "yt-dlp";
  version = "2021.10.22";

  src = fetchPypi {
    inherit pname;
    version = builtins.replaceStrings [ ".0" ] [ "." ] version;
    sha256 = "sha256-okuWZr0iNBSeTajE8Wu45fdGwpQo0S7gT8HBG1JHowc=";
  };

  propagatedBuildInputs = [ websockets mutagen ] ++ lib.optional hlsEncryptedSupport pycryptodomex;

  makeWrapperArgs = let packagesToBinPath = [ atomicparsley ]
    ++ lib.optional ffmpegSupport ffmpeg
    ++ lib.optional rtmpSupport rtmpdump
    ++ lib.optional phantomjsSupport phantomjs2;
  in [ ''--prefix PATH : "${lib.makeBinPath packagesToBinPath}"'' ];

  doCheck = false;
  setupPyBuildFlags = [ "build_lazy_extractors" ];
  postInstall = lib.optionalString withAlias ''ln -s "$out/bin/yt-dlp" "$out/bin/youtube-dl"'';

  meta = with lib; {
    license = licenses.unlicense;
    maintainers = with maintainers; [ mkg20001 ];
    homepage = "https://github.com/yt-dlp/yt-dlp/";
    changelog = "https://github.com/yt-dlp/yt-dlp/raw/${version}/Changelog.md";
    description = "Command-line tool to download videos from YouTube.com and other sites (youtube-dl fork)";
  };
}