summary refs log tree commit diff
path: root/pkgs/development/python-modules/libgpuarray/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/libgpuarray/default.nix')
-rw-r--r--pkgs/development/python-modules/libgpuarray/default.nix13
1 files changed, 8 insertions, 5 deletions
diff --git a/pkgs/development/python-modules/libgpuarray/default.nix b/pkgs/development/python-modules/libgpuarray/default.nix
index c0c2b205f58b..14e83584678c 100644
--- a/pkgs/development/python-modules/libgpuarray/default.nix
+++ b/pkgs/development/python-modules/libgpuarray/default.nix
@@ -9,10 +9,13 @@
 , nose
 , Mako
 , python
-, cudaSupport ? false, cudatoolkit
+, cudaSupport ? false, cudatoolkit , nvidia_x11
 , openclSupport ? true, ocl-icd, clblas
 }:
 
+assert cudaSupport -> nvidia_x11 != null
+                   && cudatoolkit != null;
+
 buildPythonPackage rec {
   pname = "libgpuarray";
   version = "0.7.5";
@@ -32,8 +35,8 @@ buildPythonPackage rec {
 
   libraryPath = lib.makeLibraryPath (
     []
-    ++ lib.optionals cudaSupport [ cudatoolkit.lib cudatoolkit.out ]
-    ++ lib.optionals openclSupport [ ocl-icd clblas ]
+    ++ lib.optionals cudaSupport [ cudatoolkit.lib cudatoolkit.out nvidia_x11 ]
+    ++ lib.optionals openclSupport ([ clblas ] ++ lib.optional (!stdenv.isDarwin) ocl-icd)
   );
 
   preBuild = ''
@@ -47,7 +50,7 @@ buildPythonPackage rec {
 
   postFixup = ''
     rm $out/lib/libgpuarray-static.a
-
+  '' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
     function fixRunPath {
       p=$(patchelf --print-rpath $1)
       patchelf --set-rpath "$p:$libraryPath" $1
@@ -75,7 +78,7 @@ buildPythonPackage rec {
     description = "Library to manipulate tensors on GPU.";
     license = licenses.free;
     maintainers = with maintainers; [ artuuge ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 
 }