diff options
Diffstat (limited to 'pkgs/test/cuda/cuda-samples/extension.nix')
-rw-r--r-- | pkgs/test/cuda/cuda-samples/extension.nix | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/pkgs/test/cuda/cuda-samples/extension.nix b/pkgs/test/cuda/cuda-samples/extension.nix index 664349416b713..d41da90cd5d0e 100644 --- a/pkgs/test/cuda/cuda-samples/extension.nix +++ b/pkgs/test/cuda/cuda-samples/extension.nix @@ -1,14 +1,18 @@ -final: prev: let - - sha256 = { - "10.0" = "1zvh4xsdyc59m87brpcmssxsjlp9dkynh4asnkcmc3g94f53l0jw"; - "10.1" = "1s8ka0hznrni36ajhzf2gqpdrl8kd8fi047qijxks5l2abc093qd"; - "10.2" = "01p1innzgh9siacpld6nsqimj8jkg93rk4gj8q4crn62pa5vhd94"; - "11.0" = "1n3vjc8c7zdig2xgl5fppavrphqzhdiv9m9nk6smh4f99fwi0705"; - "11.1" = "1kjixk50i8y1bkiwbdn5lkv342crvkmbvy1xl5j3lsa1ica21kwh"; - "11.2" = "1p1qjvfbm28l933mmnln02rqrf0cy9kbpsyb488d1haiqzvrazl1"; - "11.3" = "0kbibb6pgz8j5iq6284axcnmycaha9bw8qlmdp6yfwmnahq1v0yz"; - "11.4" = "082dkk5y34wyvjgj2p5j1d00rk8xaxb9z0mhvz16bd469r1bw2qk"; +{ + cudaVersion, + hostPlatform, + lib, +}: +let + cudaVersionToHash = { + "10.0" = "sha256-XAI6iiPpDVbZtFoRaP1s6VKpu9aV3bwOqqkw33QncP8="; + "10.1" = "sha256-DY8E2FKCFj27jPgQEB1qE9HcLn7CfSiVGdFm+yFQE+k="; + "10.2" = "sha256-JDW4i7rC2MwIRvKRmUd6UyJZI9bWNHqZijrB962N4QY="; + "11.0" = "sha256-BRwQuUvJEVi1mTbVtGODH8Obt7rXFfq6eLH9wxCTe9g="; + "11.1" = "sha256-kM8gFItBaTpkoT34vercmQky9qTFtsXjXMGjCMrsUc4="; + "11.2" = "sha256-gX6V98dRwdAQIsvru2byDLiMswCW2lrHSBSJutyWONw="; + "11.3" = "sha256-34MdMFS2cufNbZVixFdSUDFfLeuKIGFwLBL9d81acU0="; + "11.4" = "sha256-Ewu+Qk6GtGXC37CCn1ZXHc0MQAuyXCGf3J6T4cucTSA="; "11.5" = "sha256-AKRZbke0K59lakhTi8dX2cR2aBuWPZkiQxyKaZTvHrI="; "11.6" = "sha256-AsLNmAplfuQbXg9zt09tXAuFJ524EtTYsQuUlV1tPkE="; # The tag 11.7 of cuda-samples does not exist @@ -16,10 +20,23 @@ final: prev: let "12.0" = "sha256-Lj2kbdVFrJo5xPYPMiE4BS7Z8gpU5JLKXVJhZABUe/g="; "12.1" = "sha256-xE0luOMq46zVsIEWwK4xjLs7NorcTIi9gbfZPVjIlqo="; "12.2" = "sha256-pOy0qfDjA/Nr0T9PNKKefK/63gQnJV2MQsN2g3S2yng="; + "12.3" = "sha256-fjVp0G6uRCWxsfe+gOwWTN+esZfk0O5uxS623u0REAk="; }; -in prev.lib.attrsets.optionalAttrs (builtins.hasAttr prev.cudaVersion sha256) { - cuda-samples = final.callPackage ./generic.nix { - sha256 = sha256.${prev.cudaVersion}; - }; -} + # Samples are built around the CUDA Toolkit, which is not available for + # aarch64. Check for both CUDA version and platform. + cudaVersionIsSupported = cudaVersionToHash ? ${cudaVersion}; + platformIsSupported = hostPlatform.isx86_64; + isSupported = cudaVersionIsSupported && platformIsSupported; + + # Build our extension + extension = + final: _: + lib.attrsets.optionalAttrs isSupported { + cuda-samples = final.callPackage ./generic.nix { + inherit cudaVersion; + hash = cudaVersionToHash.${cudaVersion}; + }; + }; +in +extension |