aboutsummaryrefslogtreecommitdiff
path: root/.config/nixpkgs/packages/youtube-dl/default.nix
blob: 3dc4a273fb44d9b1bd3e24eb61fe9c983b8f6a8e (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ python38Packages, lib, fetchurl, zip, ffmpeg, rtmpdump, phantomjs2
, atomicparsley, pandoc, generateManPage ? true, ffmpegSupport ? true
, rtmpSupport ? true, phantomjsSupport ? false, hlsEncryptedSupport ? true
, installShellFiles, makeWrapper }:

python38Packages.buildPythonPackage rec {

  pname = "youtube-dl";
  version = "2020.12.05";

  src = fetchurl {
    url = "https://yt-dl.org/downloads/${version}/${pname}-${version}.tar.gz";
    sha256 = "065s45l8qz7wlkaxw9bj20gq9647zpwdj9vc6chhqjscl63z1aqm";
  };

  nativeBuildInputs = [ installShellFiles makeWrapper ];
  buildInputs = [ zip ] ++ lib.optional generateManPage pandoc;
  propagatedBuildInputs =
    lib.optional hlsEncryptedSupport python38Packages.pycryptodome;

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

  setupPyBuildFlags = [ "build_lazy_extractors" ];

  postInstall = ''
    installShellCompletion youtube-dl.zsh
  '';

  doCheck = false;

  meta = with lib; {
    homepage = "https://ytdl-org.github.io/youtube-dl/";
    description =
      "Command-line tool to download videos from YouTube.com and other sites";
    longDescription = ''
      youtube-dl is a small, Python-based command-line program
      to download videos from YouTube.com and a few more sites.
      youtube-dl is released to the public domain, which means
      you can modify it, redistribute it or use it however you like.
    '';
    license = licenses.publicDomain;
    platforms = with platforms; linux ++ darwin;
    maintainers = with maintainers; [
      bluescreen303
      phreedom
      AndersonTorres
      fpletz
      enzime
      ma27
    ];
  };
}