summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/configuration-common.nix
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2015-02-25 14:26:50 +0100
committerPeter Simons <simons@cryp.to>2015-02-25 16:52:02 +0100
commitaaf09cd216bf5057b7dd60ed286da9bbec2ae0d7 (patch)
tree4e63c9267e12709f5bb2aa65e596674b25978214 /pkgs/development/haskell-modules/configuration-common.nix
parentd3156d3ca2430da544df46a6e075336ed981a1b6 (diff)
downloadnixpkgs-aaf09cd216bf5057b7dd60ed286da9bbec2ae0d7.tar
nixpkgs-aaf09cd216bf5057b7dd60ed286da9bbec2ae0d7.tar.gz
nixpkgs-aaf09cd216bf5057b7dd60ed286da9bbec2ae0d7.tar.bz2
nixpkgs-aaf09cd216bf5057b7dd60ed286da9bbec2ae0d7.tar.lz
nixpkgs-aaf09cd216bf5057b7dd60ed286da9bbec2ae0d7.tar.xz
nixpkgs-aaf09cd216bf5057b7dd60ed286da9bbec2ae0d7.tar.zst
nixpkgs-aaf09cd216bf5057b7dd60ed286da9bbec2ae0d7.zip
haskell-cuda: jump through hoops to make this build succeed
The package has undeclared dependencies on 'nvidia_x11' and 'cudatoolkit', the
latter of which also comes with a non-standard directory layout that our
builder cannot handle without help. Last but not least, the build hard-codes
impure search paths like /usr/local/cuda that need to be patched out.

Resolves https://github.com/NixOS/nixpkgs/issues/6562.
Diffstat (limited to 'pkgs/development/haskell-modules/configuration-common.nix')
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index f841439bb02..bc18b1dc3ac 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -43,6 +43,20 @@ self: super: {
     hinotify = if pkgs.stdenv.isLinux then self.hinotify else self.fsnotify;
   };
 
+  # CUDA needs help finding the SDK headers and libraries.
+  cuda = overrideCabal super.cuda (drv: {
+    extraLibraries = (drv.extraLibraries or []) ++ [pkgs.linuxPackages.nvidia_x11];
+    configureFlags = (drv.configureFlags or []) ++
+      pkgs.lib.optional pkgs.stdenv.is64bit "--extra-lib-dirs=${pkgs.cudatoolkit}/lib64" ++ [
+      "--extra-lib-dirs=${pkgs.cudatoolkit}/lib"
+      "--extra-include-dirs=${pkgs.cudatoolkit}/usr_include"
+    ];
+    preConfigure = ''
+      unset CC          # unconfuse the haskell-cuda configure script
+      sed -i -e 's|/usr/local/cuda|${pkgs.cudatoolkit}|g' configure
+    '';
+  });
+
   # Depends on code distributed under a non-free license.
   bindings-yices = dontDistribute super.bindings-yices;
   yices = dontDistribute super.yices;