_cuda.lib.allowUnfreeCudaPredicate: derive from _cuda.lib.licenses
Signed-off-by: Connor Baker <ConnorBaker01@gmail.com>
This commit is contained in:
@@ -26,23 +26,9 @@ All CUDA package sets include common CUDA packages like `libcublas`, `cudnn`, `t
|
||||
CUDA support is not enabled by default in Nixpkgs. To enable CUDA support, make sure Nixpkgs is imported with a configuration similar to the following:
|
||||
|
||||
```nix
|
||||
{ pkgs }:
|
||||
{
|
||||
allowUnfreePredicate =
|
||||
let
|
||||
ensureList = x: if builtins.isList x then x else [ x ];
|
||||
in
|
||||
package:
|
||||
builtins.all (
|
||||
license:
|
||||
license.free
|
||||
|| builtins.elem license.shortName [
|
||||
"CUDA EULA"
|
||||
"cuDNN EULA"
|
||||
"cuSPARSELt EULA"
|
||||
"cuTENSOR EULA"
|
||||
"NVidia OptiX EULA"
|
||||
]
|
||||
) (ensureList package.meta.license);
|
||||
allowUnfreePredicate = pkgs._cuda.lib.allowUnfreeCudaPredicate;
|
||||
cudaCapabilities = [ <target-architectures> ];
|
||||
cudaForwardCompat = true;
|
||||
cudaSupport = true;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ lib }:
|
||||
{ _cuda, lib }:
|
||||
{
|
||||
/**
|
||||
Returns whether a capability should be built by default for a particular CUDA version.
|
||||
@@ -114,16 +114,14 @@
|
||||
```
|
||||
*/
|
||||
allowUnfreeCudaPredicate =
|
||||
package:
|
||||
lib.all (
|
||||
license:
|
||||
license.free
|
||||
|| lib.elem license.shortName [
|
||||
"CUDA EULA"
|
||||
"cuDNN EULA"
|
||||
"cuSPARSELt EULA"
|
||||
"cuTENSOR EULA"
|
||||
"NVidia OptiX EULA"
|
||||
let
|
||||
cudaLicenseNames = [
|
||||
lib.licenses.nvidiaCuda.shortName
|
||||
]
|
||||
) (lib.toList package.meta.license);
|
||||
++ lib.map (license: license.shortName) (lib.attrValues _cuda.lib.licenses);
|
||||
in
|
||||
package:
|
||||
lib.all (license: license.free || lib.elem license.shortName cudaLicenseNames) (
|
||||
lib.toList package.meta.license
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
;
|
||||
|
||||
# See ./cuda.nix for documentation.
|
||||
inherit (import ./cuda.nix { inherit lib; })
|
||||
inherit (import ./cuda.nix { inherit _cuda lib; })
|
||||
_cudaCapabilityIsDefault
|
||||
_cudaCapabilityIsSupported
|
||||
_mkCudaVariant
|
||||
|
||||
Reference in New Issue
Block a user