From 51ce29718750fb34c0d849942a9462e520081577 Mon Sep 17 00:00:00 2001 From: William Giokas <1007380@gmail.com> Date: Sun, 7 Jun 2015 11:34:29 -0700 Subject: [PATCH] youtube-dl: make a python package This allows youtube-dl to support all versions of python, and be built correctly even when the python version is overridden by the user. An alias to youtube-dl has been added which points to the default python version's youtube-dl. Also, ffmpeg has been made into an optional dependency. If ffmpeg is set to 'null' then it will not be built and there will be no wrapper for it either. An extra package, youtube-dl-light, is the same as youtube-dl but without the ffmpeg dependency. --- pkgs/tools/misc/youtube-dl/default.nix | 18 ++++++------------ pkgs/top-level/all-packages.nix | 7 +------ pkgs/top-level/python-packages.nix | 13 +++++++++++++ 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/pkgs/tools/misc/youtube-dl/default.nix b/pkgs/tools/misc/youtube-dl/default.nix index 3985f8a0c838..eb3375730188 100644 --- a/pkgs/tools/misc/youtube-dl/default.nix +++ b/pkgs/tools/misc/youtube-dl/default.nix @@ -1,4 +1,5 @@ -{ stdenv, fetchurl, makeWrapper, python, zip, ffmpeg, pandoc ? null }: +{ stdenv, fetchurl, makeWrapper, buildPythonPackage, zip, ffmpeg +, pandoc ? null }: # Pandoc is required to build the package's man page. Release tarballs # contain a formatted man page already, though, so it's fine to pass @@ -7,7 +8,7 @@ # case someone wants to use this derivation to build a Git version of # the tool that doesn't have the formatted man page included. -stdenv.mkDerivation rec { +buildPythonPackage rec { name = "youtube-dl-${version}"; version = "2015.05.29"; @@ -16,18 +17,11 @@ stdenv.mkDerivation rec { sha256 = "0lgxir2i5ipplg57wk8gnbbsdrk7szqnyb1bxr97f3h0rbm4dfij"; }; - buildInputs = [ python makeWrapper zip pandoc ]; - - patchPhase = "rm youtube-dl"; - - configurePhase = '' - makeFlagsArray=( PREFIX=$out SYSCONFDIR=$out/etc PYTHON=${python}/bin/python ) - ''; + buildInputs = [ makeWrapper zip pandoc ]; # Ensure ffmpeg is available in $PATH for post-processing & transcoding support. - postInstall = '' - wrapProgram $out/bin/youtube-dl --prefix PATH : "${ffmpeg}/bin" - ''; + postInstall = stdenv.lib.optionalString (ffmpeg != null) + ''wrapProgram $out/bin/youtube-dl --prefix PATH : "${ffmpeg}/bin"''; meta = with stdenv.lib; { homepage = "http://rg3.github.com/youtube-dl/"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b49c2e3b59da..3eb1ef1fddd6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3391,12 +3391,6 @@ let # To expose more packages for Yi, override the extraPackages arg. yi = callPackage ../applications/editors/yi/wrapper.nix { }; - youtube-dl = callPackage ../tools/misc/youtube-dl { - # Release versions don't need pandoc because the formatted man page - # is included in the tarball. - pandoc = null; - }; - zbar = callPackage ../tools/graphics/zbar { pygtk = lib.overrideDerivation pygtk (x: { gtk = gtk2; @@ -14774,6 +14768,7 @@ let lttngUst = lttng-ust; # added 2014-07-31 jquery_ui = jquery-ui; # added 2014-09-07 youtubeDL = youtube-dl; # added 2014-10-26 + youtube-dl = pythonPackages.youtube-dl; # added 2015-06-07 rdiff_backup = rdiff-backup; # added 2014-11-23 htmlTidy = html-tidy; # added 2014-12-06 libtidy = html-tidy; # added 2014-12-21 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index d3ddc879a17a..c602200e81f7 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -13466,6 +13466,19 @@ let }; }); + youtube-dl = callPackage ../tools/misc/youtube-dl { + # Release versions don't need pandoc because the formatted man page + # is included in the tarball. + pandoc = null; + }; + + youtube-dl-light = callPackage ../tools/misc/youtube-dl { + # Release versions don't need pandoc because the formatted man page + # is included in the tarball. + ffmpeg = null; + pandoc = null; + }; + zbase32 = buildPythonPackage (rec { name = "zbase32-1.1.2";