about summary refs log tree commit diff
path: root/pkgs/development/libraries/science/math/cudnn
diff options
context:
space:
mode:
authorDennis Gosnell <cdep.illabout@gmail.com>2021-03-09 14:04:39 +0900
committerDennis Gosnell <dennis@chewbacca.xc>2021-03-10 21:30:51 +0900
commite3c1c3b35b4c49fa94408df8ef752e19c1163444 (patch)
treea0f9aabd6b48317b968f1b12c17195802e43153a /pkgs/development/libraries/science/math/cudnn
parent86ee8dd8ff48f2da3577077720adf587b72908b8 (diff)
cudnnPackages: Remove statically linked .a files.
Diffstat (limited to 'pkgs/development/libraries/science/math/cudnn')
-rw-r--r--pkgs/development/libraries/science/math/cudnn/generic.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkgs/development/libraries/science/math/cudnn/generic.nix b/pkgs/development/libraries/science/math/cudnn/generic.nix
index 566a17c614729..d9c19e6790c6b 100644
--- a/pkgs/development/libraries/science/math/cudnn/generic.nix
+++ b/pkgs/development/libraries/science/math/cudnn/generic.nix
@@ -8,6 +8,14 @@
 , cudatoolkit
 , fetchurl
 , addOpenGLRunpath
+, # The distributed version of CUDNN includes both dynamically liked .so files,
+  # as well as statically linked .a files.  However, CUDNN is quite large
+  # (multiple gigabytes), so you can save some space in your nix store by
+  # removing the statically linked libraries if you are not using them.
+  #
+  # Setting this to true removes the statically linked .a files.
+  # Setting this to false keeps these statically linked .a files.
+  removeStatic ? false
 }:
 
 stdenv.mkDerivation {
@@ -23,6 +31,8 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ addOpenGLRunpath ];
 
   installPhase = ''
+    runHook preInstall
+
     function fixRunPath {
       p=$(patchelf --print-rpath $1)
       patchelf --set-rpath "''${p:+$p:}${lib.makeLibraryPath [ stdenv.cc.cc ]}:\$ORIGIN/" $1
@@ -35,6 +45,10 @@ stdenv.mkDerivation {
     mkdir -p $out
     cp -a include $out/include
     cp -a lib64 $out/lib64
+  '' + lib.optionalString removeStatic ''
+    rm -f $out/lib64/*.a
+  '' + ''
+    runHook postInstall
   '';
 
   # Set RUNPATH so that libcuda in /run/opengl-driver(-32)/lib can be found.