summary refs log tree commit diff
path: root/pkgs/tools/misc/youtube-dl
diff options
context:
space:
mode:
authorWilliam Giokas <1007380@gmail.com>2015-06-07 11:34:29 -0700
committerWilliam Giokas <1007380@gmail.com>2015-06-10 15:50:17 -0700
commit51ce29718750fb34c0d849942a9462e520081577 (patch)
tree5b5b6174e410c270ad08273160ddb857873ad5cc /pkgs/tools/misc/youtube-dl
parent514a9fdf878a65bca0e329cbb733070f3bd0ab0f (diff)
downloadnixlib-51ce29718750fb34c0d849942a9462e520081577.tar
nixlib-51ce29718750fb34c0d849942a9462e520081577.tar.gz
nixlib-51ce29718750fb34c0d849942a9462e520081577.tar.bz2
nixlib-51ce29718750fb34c0d849942a9462e520081577.tar.lz
nixlib-51ce29718750fb34c0d849942a9462e520081577.tar.xz
nixlib-51ce29718750fb34c0d849942a9462e520081577.tar.zst
nixlib-51ce29718750fb34c0d849942a9462e520081577.zip
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.
Diffstat (limited to 'pkgs/tools/misc/youtube-dl')
-rw-r--r--pkgs/tools/misc/youtube-dl/default.nix18
1 files changed, 6 insertions, 12 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/";