-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
/
overrides.nix
116 lines (105 loc) · 3.98 KB
/
overrides.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
final: prev:
let
inherit (prev) lib pkgs;
in
(lib.filterAttrs (attr: _: (prev ? "${attr}")) {
### Overrides to fix the components of cudatoolkit-redist
# Attributes that don't exist in the previous set are removed.
# That means only overrides can go here, and not new expressions!
libcufile = prev.libcufile.overrideAttrs (oldAttrs: {
buildInputs = oldAttrs.buildInputs ++ [
prev.libcublas
pkgs.numactl
pkgs.rdma-core
];
# libcuda needs to be resolved during runtime
autoPatchelfIgnoreMissingDeps = true;
});
libcusolver = final.addBuildInputs prev.libcusolver [
prev.libcublas
];
cuda_nvcc = prev.cuda_nvcc.overrideAttrs (oldAttrs:
let
inherit (prev.backendStdenv) cc;
in
{
# Point NVCC at a compatible compiler
# FIXME: non-redist cudatoolkit copy-pastes this code
# For CMake-based projects:
# https://cmake.org/cmake/help/latest/module/FindCUDA.html#input-variables
# https://cmake.org/cmake/help/latest/envvar/CUDAHOSTCXX.html
# https://cmake.org/cmake/help/latest/variable/CMAKE_CUDA_HOST_COMPILER.html
# For non-CMake projects:
# We prepend --compiler-bindir to nvcc flags.
# Downstream packages can override these, because NVCC
# uses the last --compiler-bindir it gets on the command line.
# FIXME: this results in "incompatible redefinition" warnings.
# https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#compiler-bindir-directory-ccbin
# NOTE: We unconditionally set -Xfatbin=-compress-all, which reduces the size of the
# compiled binaries. If binaries grow over 2GB, they will fail to link. This is a problem
# for us, as the default set of CUDA capabilities we build can regularly cause this to
# occur (for example, with Magma).
postInstall = (oldAttrs.postInstall or "") + ''
mkdir -p $out/nix-support
cat <<EOF >> $out/nix-support/setup-hook
cmakeFlags+=' -DCUDA_HOST_COMPILER=${cc}/bin'
cmakeFlags+=' -DCMAKE_CUDA_HOST_COMPILER=${cc}/bin'
if [ -z "\''${CUDAHOSTCXX-}" ]; then
export CUDAHOSTCXX=${cc}/bin;
fi
export NVCC_PREPEND_FLAGS+=' --compiler-bindir=${cc}/bin -Xfatbin=-compress-all'
EOF
'';
});
cuda_nvprof = prev.cuda_nvprof.overrideAttrs (oldAttrs: {
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ pkgs.addOpenGLRunpath ];
buildInputs = oldAttrs.buildInputs ++ [ prev.cuda_cupti ];
# libcuda needs to be resolved during runtime
autoPatchelfIgnoreMissingDeps = true;
});
cuda_demo_suite = final.addBuildInputs prev.cuda_demo_suite [
pkgs.freeglut
pkgs.libGLU
pkgs.libglvnd
pkgs.mesa
prev.libcufft
prev.libcurand
];
nsight_compute = prev.nsight_compute.overrideAttrs (oldAttrs: {
nativeBuildInputs = oldAttrs.nativeBuildInputs
++ (if (lib.versionOlder prev.nsight_compute.version "2022.2.0")
then [ pkgs.qt5.wrapQtAppsHook ]
else [ pkgs.qt6.wrapQtAppsHook ]);
buildInputs = oldAttrs.buildInputs
++ (if (lib.versionOlder prev.nsight_compute.version "2022.2.0")
then [ pkgs.qt5.qtwebview ]
else [ pkgs.qt6.qtwebview ]);
});
nsight_systems = prev.nsight_systems.overrideAttrs (oldAttrs: {
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [
pkgs.addOpenGLRunpath
pkgs.qt5.wrapQtAppsHook
];
buildInputs = oldAttrs.buildInputs ++ [
pkgs.alsa-lib
pkgs.e2fsprogs
pkgs.nss
pkgs.numactl
pkgs.pulseaudio
pkgs.wayland
pkgs.xorg.libXcursor
pkgs.xorg.libXdamage
pkgs.xorg.libXrandr
pkgs.xorg.libXtst
];
# libcuda needs to be resolved during runtime
autoPatchelfIgnoreMissingDeps = true;
});
nvidia_driver = prev.nvidia_driver.overrideAttrs (oldAttrs: {
# libcuda needs to be resolved during runtime
autoPatchelfIgnoreMissingDeps = true;
# No need to support this package as we have drivers already
# in linuxPackages.
meta.broken = true;
});
})