cudnn_cudatoolkit: accept `hash` attribute for SRI hashes

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