Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkgs/stdenv/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
48 changes: 48 additions & 0 deletions pkgs/top-level/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
};
Expand Down
Loading