diff options
Diffstat (limited to 'pkgs/development/compilers/cudatoolkit/redist/build-cuda-redist-package.nix')
-rw-r--r-- | pkgs/development/compilers/cudatoolkit/redist/build-cuda-redist-package.nix | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/pkgs/development/compilers/cudatoolkit/redist/build-cuda-redist-package.nix b/pkgs/development/compilers/cudatoolkit/redist/build-cuda-redist-package.nix new file mode 100644 index 000000000000..9bbd7ea1da11 --- /dev/null +++ b/pkgs/development/compilers/cudatoolkit/redist/build-cuda-redist-package.nix @@ -0,0 +1,51 @@ +{ lib +, stdenv +, fetchurl +, autoPatchelfHook +, autoAddOpenGLRunpathHook +}: + +pname: +attrs: + +let + arch = "linux-x86_64"; +in stdenv.mkDerivation { + inherit pname; + inherit (attrs) version; + + src = assert (lib.hasAttr arch attrs); fetchurl { + url = "https://developer.download.nvidia.com/compute/cuda/redist/${attrs.${arch}.relative_path}"; + inherit (attrs.${arch}) sha256; + }; + + nativeBuildInputs = [ + autoPatchelfHook + # This hook will make sure libcuda can be found + # in typically /lib/opengl-driver by adding that + # directory to the rpath of all ELF binaries. + # Check e.g. with `patchelf --print-rpath path/to/my/binary + autoAddOpenGLRunpathHook + ]; + + buildInputs = [ + stdenv.cc.cc.lib + ]; + + dontBuild = true; + + # TODO: choose whether to install static/dynamic libs + installPhase = '' + runHook preInstall + rm LICENSE + mkdir -p $out + mv * $out + runHook postInstall + ''; + + meta = { + description = attrs.name; + license = lib.licenses.unfree; + platforms = lib.optionals (lib.hasAttr arch attrs) [ "x86_64-linux" ]; + }; +} |