mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-31 17:23:34 +00:00
cuda-modules: don't use *Platform attributes from pkgs
For more information about *why* this is desirable, see https://github.com/NixOS/nixpkgs/pull/45717 and https://github.com/NixOS/nixpkgs/issues/27069
This commit is contained in:
parent
2639fa16b9
commit
14635b4092
@ -1,5 +1,12 @@
|
||||
{ hostPlatform, lib }:
|
||||
{
|
||||
lib,
|
||||
# NOTE: We would use backendStdenv to get the hostPlatform, but it's not available in the callPackage context
|
||||
# we're using to call this file.
|
||||
stdenv,
|
||||
}:
|
||||
let
|
||||
inherit (stdenv) hostPlatform;
|
||||
|
||||
# Samples are built around the CUDA Toolkit, which is not available for
|
||||
# aarch64. Check for both CUDA version and platform.
|
||||
platformIsSupported = hostPlatform.isx86_64 && hostPlatform.isLinux;
|
||||
|
@ -1,7 +1,9 @@
|
||||
{
|
||||
cudaVersion,
|
||||
hostPlatform,
|
||||
lib,
|
||||
# NOTE: We would use backendStdenv to get the hostPlatform, but it's not available in the callPackage context
|
||||
# we're using to call this file.
|
||||
stdenv,
|
||||
}:
|
||||
let
|
||||
cudaVersionToHash = {
|
||||
@ -23,6 +25,8 @@ let
|
||||
"12.3" = "sha256-fjVp0G6uRCWxsfe+gOwWTN+esZfk0O5uxS623u0REAk=";
|
||||
};
|
||||
|
||||
inherit (stdenv) hostPlatform;
|
||||
|
||||
# Samples are built around the CUDA Toolkit, which is not available for
|
||||
# aarch64. Check for both CUDA version and platform.
|
||||
cudaVersionIsSupported = cudaVersionToHash ? ${cudaVersion};
|
||||
|
@ -15,9 +15,11 @@
|
||||
{
|
||||
cudaVersion,
|
||||
flags,
|
||||
hostPlatform,
|
||||
lib,
|
||||
mkVersionedPackageName,
|
||||
# NOTE: We would use backendStdenv to get the hostPlatform, but it's not available in the callPackage context
|
||||
# we're using to call this file.
|
||||
stdenv,
|
||||
}:
|
||||
let
|
||||
inherit (lib)
|
||||
@ -29,6 +31,8 @@ let
|
||||
trivial
|
||||
;
|
||||
|
||||
inherit (stdenv) hostPlatform;
|
||||
|
||||
redistName = "cutensor";
|
||||
pname = "libcutensor";
|
||||
|
||||
|
@ -7,7 +7,9 @@
|
||||
cudaForwardCompat ? (config.cudaForwardCompat or true),
|
||||
lib,
|
||||
cudaVersion,
|
||||
hostPlatform,
|
||||
# NOTE: We cannot refer to backendStdenv as flags exists outside the fixed-point;
|
||||
# otherwise, we would use that to get the hostPlatform.
|
||||
stdenv,
|
||||
# gpus :: List Gpu
|
||||
gpus,
|
||||
}:
|
||||
@ -20,6 +22,8 @@ let
|
||||
trivial
|
||||
;
|
||||
|
||||
inherit (stdenv) hostPlatform;
|
||||
|
||||
# Flags are determined based on your CUDA toolkit by default. You may benefit
|
||||
# from improved performance, reduced file size, or greater hardware support by
|
||||
# passing a configuration based on your specific GPU environment.
|
||||
|
@ -10,7 +10,6 @@
|
||||
markForCudatoolkitRootHook,
|
||||
flags,
|
||||
stdenv,
|
||||
hostPlatform,
|
||||
# Builder-specific arguments
|
||||
# Short package name (e.g., "cuda_cccl")
|
||||
# pname : String
|
||||
@ -40,6 +39,8 @@ let
|
||||
sourceTypes
|
||||
;
|
||||
|
||||
inherit (backendStdenv) hostPlatform;
|
||||
|
||||
# Get the redist architectures for which package provides distributables.
|
||||
# These are used by meta.platforms.
|
||||
supportedRedistArchs = builtins.attrNames featureRelease;
|
||||
@ -48,7 +49,7 @@ let
|
||||
# It is `"unsupported"` if the redistributable is not supported on the target platform.
|
||||
redistArch = flags.getRedistArch hostPlatform.system;
|
||||
|
||||
sourceMatchesHost = flags.getNixSystem redistArch == stdenv.hostPlatform.system;
|
||||
sourceMatchesHost = flags.getNixSystem redistArch == hostPlatform.system;
|
||||
in
|
||||
backendStdenv.mkDerivation (finalAttrs: {
|
||||
# NOTE: Even though there's no actual buildPhase going on here, the derivations of the
|
||||
|
@ -3,7 +3,9 @@
|
||||
lib,
|
||||
cudaVersion,
|
||||
flags,
|
||||
hostPlatform,
|
||||
# NOTE: We would use backendStdenv to get the hostPlatform, but it's not available in the callPackage context
|
||||
# we're using to call this file (cudaPackages.callPackage).
|
||||
stdenv,
|
||||
# Expected to be passed by the caller
|
||||
mkVersionedPackageName,
|
||||
# pname :: String
|
||||
@ -40,6 +42,8 @@ let
|
||||
strings
|
||||
;
|
||||
|
||||
inherit (stdenv) hostPlatform;
|
||||
|
||||
evaluatedModules = modules.evalModules {
|
||||
modules = [
|
||||
../modules
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
backendStdenv,
|
||||
cudaVersion,
|
||||
final,
|
||||
hostPlatform,
|
||||
lib,
|
||||
mkVersionedPackageName,
|
||||
package,
|
||||
@ -17,6 +17,7 @@ let
|
||||
strings
|
||||
versions
|
||||
;
|
||||
inherit (backendStdenv) hostPlatform;
|
||||
# targetArch :: String
|
||||
targetArch = attrsets.attrByPath [ hostPlatform.system ] "unsupported" {
|
||||
x86_64-linux = "x86_64-linux-gnu";
|
||||
|
Loading…
Reference in New Issue
Block a user