summary refs log tree commit diff
path: root/pkgs/development/tools/phantomjs/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/phantomjs/default.nix')
-rw-r--r--pkgs/development/tools/phantomjs/default.nix32
1 files changed, 20 insertions, 12 deletions
diff --git a/pkgs/development/tools/phantomjs/default.nix b/pkgs/development/tools/phantomjs/default.nix
index 7eea3bedcef..6fc53595efb 100644
--- a/pkgs/development/tools/phantomjs/default.nix
+++ b/pkgs/development/tools/phantomjs/default.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchurl, freetype, fontconfig, openssl }:
+{ stdenv, fetchurl, freetype, fontconfig, openssl, unzip }:
 
-assert stdenv.lib.elem stdenv.system [ "i686-linux" "x86_64-linux" ];
+assert stdenv.lib.elem stdenv.system [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
 
 stdenv.mkDerivation rec {
-  name = "phantomjs-1.9.2";
+  name = "phantomjs-1.9.7";
 
   # I chose to use the binary build for now.
   # The source version is quite nasty to compile
@@ -12,16 +12,24 @@ stdenv.mkDerivation rec {
 
   src = if stdenv.system == "i686-linux" then
           fetchurl {
-            url = "http://phantomjs.googlecode.com/files/${name}-linux-i686.tar.bz2";
-            sha256 = "1nywb9xhcfjark6zfjlnrljc08r5185vv25vfcc65jzla8hy75qp";
+            url = "https://bitbucket.org/ariya/phantomjs/downloads/${name}-linux-i686.tar.bz2";
+            sha256 = "1ffd5544wnkww5cgwsims4bk4bymvm6pm19p32nbhwabxqhbnj9a";
           }
-        else # x86_64-linux
-          fetchurl {
-            url = "http://phantomjs.googlecode.com/files/${name}-linux-x86_64.tar.bz2";
-            sha256 = "1xsjx4j6rwkq27y4iqdn0ai4yrq70a3g9309blywki0g976phccg";
-          };
+        else
+          if stdenv.system == "x86_64-linux" then
+            fetchurl {
+              url = "https://bitbucket.org/ariya/phantomjs/downloads/${name}-linux-x86_64.tar.bz2";
+              sha256 = "06mhvj8rx298j0mrijw48zfm28hqgy81vdr1vv0jp4ncxbvijfs7";
+            }
+          else # x86_64-darwin
+            fetchurl {
+              url = "https://bitbucket.org/ariya/phantomjs/downloads/${name}-macosx.zip";
+              sha256 = "0vsagvx181gnypi6kgmxp4br6hnvd81vyy3cbz5pxccdys7iywvj";
+            };
+
+  buildInputs = if stdenv.isDarwin then [ unzip ] else [];
 
-  buildPhase = ''
+  buildPhase = if stdenv.isDarwin then "" else ''
     patchelf \
       --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
       --set-rpath "${freetype}/lib:${fontconfig}/lib:${stdenv.gcc.gcc}/lib64:${stdenv.gcc.gcc}/lib:${openssl}/lib" \
@@ -55,6 +63,6 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.bsd3;
 
     maintainers = [ stdenv.lib.maintainers.bluescreen303 ];
-    platforms = ["i686-linux" "x86_64-linux" ];
+    platforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" ];
   };
 }