cudnn_cudatoolkit: accept `hash` attribute for SRI hashes

+10 -5
+1 -1
pkgs/development/libraries/science/math/cudnn/default.nix
··· 58 # 8.1.0 is compatible with CUDA 11.0, 11.1, and 11.2: 59 # https://docs.nvidia.com/deeplearning/cudnn/support-matrix/index.html#cudnn-cuda-hardware-versions 60 srcName = "cudnn-11.2-linux-x64-v8.1.1.33.tgz"; 61 - sha256 = "sha256-mKh4TpKGLyABjSDCgbMNSgzZUfk2lPZDPM9K6cUCumo="; 62 }; 63 64 cudnn_cudatoolkit_11_1 = cudnn_cudatoolkit_11_0.override {
··· 58 # 8.1.0 is compatible with CUDA 11.0, 11.1, and 11.2: 59 # https://docs.nvidia.com/deeplearning/cudnn/support-matrix/index.html#cudnn-cuda-hardware-versions 60 srcName = "cudnn-11.2-linux-x64-v8.1.1.33.tgz"; 61 + hash = "sha256-mKh4TpKGLyABjSDCgbMNSgzZUfk2lPZDPM9K6cUCumo="; 62 }; 63 64 cudnn_cudatoolkit_11_1 = cudnn_cudatoolkit_11_0.override {
+9 -4
pkgs/development/libraries/science/math/cudnn/generic.nix
··· 1 { version 2 , srcName 3 - , sha256 4 }: 5 6 { stdenv 7 , lib ··· 22 name = "cudatoolkit-${cudatoolkit.majorVersion}-cudnn-${version}"; 23 24 inherit version; 25 - src = fetchurl { 26 # URL from NVIDIA docker containers: https://gitlab.com/nvidia/cuda/blob/centos7/7.0/runtime/cudnn4/Dockerfile 27 url = "https://developer.download.nvidia.com/compute/redist/cudnn/v${version}/${srcName}"; 28 - inherit sha256; 29 - }; 30 31 nativeBuildInputs = [ addOpenGLRunpath ]; 32
··· 1 { version 2 , srcName 3 + , hash ? null 4 + , sha256 ? null 5 }: 6 + 7 + assert (hash != null) || (sha256 != null); 8 9 { stdenv 10 , lib ··· 25 name = "cudatoolkit-${cudatoolkit.majorVersion}-cudnn-${version}"; 26 27 inherit version; 28 + 29 + src = let 30 + hash_ = if hash != null then { inherit hash; } else { inherit sha256; }; 31 + in fetchurl ({ 32 # URL from NVIDIA docker containers: https://gitlab.com/nvidia/cuda/blob/centos7/7.0/runtime/cudnn4/Dockerfile 33 url = "https://developer.download.nvidia.com/compute/redist/cudnn/v${version}/${srcName}"; 34 + } // hash_); 35 36 nativeBuildInputs = [ addOpenGLRunpath ]; 37