nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 60 lines 1.9 kB view raw
1{ 2 _cuda, 3 backendStdenv, 4 cudaNamePrefix, 5 lib, 6 linkFarm, 7 tests, 8}: 9# NOTE: Because Nixpkgs, by default, allows aliases, this derivation may contain multiple entries for a single redistributable. 10let 11 # redists-unpacked has already found all the names of the redistributables 12 availableRedistsForPlatform = lib.filterAttrs ( 13 _: value: 14 let 15 canInstantiate = 16 (builtins.tryEval ( 17 builtins.deepSeq ((value.drvPath or null) != null) ((value.drvPath or null) != null) 18 )).value; 19 in 20 lib.warnIfNot canInstantiate 21 "Package ${value.name} is unavailable and will not be included in redists-installed" 22 canInstantiate 23 ) tests.redists-unpacked.passthru.redistsForPlatform; 24 25 mkOutputs = 26 name: drv: 27 lib.genAttrs' drv.outputs (output: { 28 name = "${name}-${output}"; 29 value = drv.${output}; 30 }); 31 32 linkedWithoutLicenses = linkFarm "${cudaNamePrefix}-redists-installed" ( 33 lib.concatMapAttrs mkOutputs availableRedistsForPlatform 34 ); 35in 36linkedWithoutLicenses.overrideAttrs ( 37 finalAttrs: prevAttrs: { 38 passthru = prevAttrs.passthru or { } // { 39 inherit availableRedistsForPlatform; 40 41 brokenAssertions = prevAttrs.passthru.brokenAssertions or [ ] ++ [ 42 { 43 message = 44 "No redists are available for the current NVIDIA system identifier (${backendStdenv.hostRedistSystem});" 45 + " ensure proper licenses are allowed and that the CUDA version in use supports the system"; 46 assertion = availableRedistsForPlatform != { }; 47 } 48 ]; 49 }; 50 51 meta = prevAttrs.meta or { } // { 52 broken = _cuda.lib._mkMetaBroken finalAttrs; 53 license = lib.unique ( 54 lib.concatMap (drv: lib.toList (drv.meta.license or [ ])) ( 55 lib.attrValues availableRedistsForPlatform 56 ) 57 ); 58 }; 59 } 60)