config: add replaceStdenv, cudaCapabilities, cudaForwardCompat options (#479234)
This commit is contained in:
@@ -43,7 +43,8 @@ in
|
||||
# Select the appropriate stages for the platform `system'.
|
||||
if crossSystem != localSystem || crossOverlays != [ ] then
|
||||
stagesCross
|
||||
else if config ? replaceStdenv then
|
||||
# The `or null` fallback is needed for contexts that don't use the module system (e.g. tarball builds).
|
||||
else if (config.replaceStdenv or null) != null then
|
||||
stagesCustom
|
||||
else if localSystem.isLinux then
|
||||
stagesLinux
|
||||
|
||||
@@ -266,6 +266,38 @@ let
|
||||
feature = "build packages with CUDA support by default";
|
||||
};
|
||||
|
||||
cudaCapabilities = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
A list of CUDA capabilities to build for.
|
||||
|
||||
Packages may use this option to control device code generation to
|
||||
take advantage of architecture-specific functionality, speed up
|
||||
compile times by producing less device code, or slim package closures.
|
||||
|
||||
For example, you can build for Ada Lovelace GPUs with
|
||||
`cudaCapabilities = [ "8.9" ];`.
|
||||
|
||||
If not provided, the default value is calculated per-package set,
|
||||
derived from a list of GPUs supported by that CUDA version.
|
||||
|
||||
See the [CUDA section](https://nixos.org/manual/nixpkgs/stable/#cuda) in
|
||||
the Nixpkgs manual for more information.
|
||||
'';
|
||||
};
|
||||
|
||||
cudaForwardCompat = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to enable PTX support for future hardware.
|
||||
|
||||
When enabled, packages will include PTX code that can be JIT-compiled
|
||||
for GPUs newer than those explicitly targeted by `cudaCapabilities`.
|
||||
'';
|
||||
};
|
||||
|
||||
replaceBootstrapFiles = mkMassRebuild {
|
||||
type = types.functionTo (types.attrsOf types.package);
|
||||
default = lib.id;
|
||||
@@ -294,6 +326,22 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
replaceStdenv = mkMassRebuild {
|
||||
type = types.nullOr (types.functionTo types.package);
|
||||
default = null;
|
||||
defaultText = literalExpression "null";
|
||||
description = ''
|
||||
A function to replace the standard environment (stdenv).
|
||||
|
||||
The function receives an attribute set with `pkgs` and should return
|
||||
a stdenv derivation.
|
||||
|
||||
This can be used to globally replace the stdenv with a custom one,
|
||||
for example to use ccache or distcc.
|
||||
'';
|
||||
example = literalExpression "{ pkgs }: pkgs.ccacheStdenv";
|
||||
};
|
||||
|
||||
rocmSupport = mkMassRebuild {
|
||||
feature = "build packages with ROCm support by default";
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user