···
# brokenConditions :: AttrSet Bool
# Sets `meta.broken = true` if any of the conditions are true.
# Example: Broken on a specific version of CUDA or when a dependency has a specific version.
131
-
brokenConditions = { };
131
+
brokenConditions = {
132
+
# Unclear how this is handled by Nix internals.
133
+
"Duplicate entries in outputs" = finalAttrs.outputs != lists.unique finalAttrs.outputs;
134
+
# Typically this results in the static output being empty, as all libraries are moved
135
+
# back to the lib output.
136
+
"lib output follows static output" =
138
+
libIndex = lists.findFirstIndex (x: x == "lib") null finalAttrs.outputs;
139
+
staticIndex = lists.findFirstIndex (x: x == "static") null finalAttrs.outputs;
141
+
libIndex != null && staticIndex != null && libIndex > staticIndex;
# badPlatformsConditions :: AttrSet Bool
# Sets `meta.badPlatforms = meta.platforms` if any of the conditions are true.
···
# src :: Optional Derivation
141
-
src = trivial.pipe redistArch [
142
-
# If redistArch doesn't exist in redistribRelease, return null.
143
-
(redistArch: redistribRelease.${redistArch} or null)
144
-
# If the release is non-null, fetch the source; otherwise, return null.
145
-
(trivial.mapNullable (
146
-
{ relative_path, sha256, ... }:
148
-
url = "https://developer.download.nvidia.com/compute/${redistName}/redist/${relative_path}";
154
-
# Handle the pkg-config files:
156
-
# 2. Location expected by the pkg-config wrapper
157
-
# 3. Generate unversioned names too
159
-
for path in pkg-config pkgconfig ; do
160
-
[[ -d "$path" ]] || continue
161
-
mkdir -p share/pkgconfig
162
-
mv "$path"/* share/pkgconfig/
166
-
for pc in share/pkgconfig/*.pc ; do
168
-
-e "s|^cudaroot\s*=.*\$|cudaroot=''${!outputDev}|" \
169
-
-e "s|^libdir\s*=.*/lib\$|libdir=''${!outputLib}/lib|" \
170
-
-e "s|^includedir\s*=.*/include\$|includedir=''${!outputDev}/include|" \
152
+
# If redistArch doesn't exist in redistribRelease, return null.
153
+
src = trivial.mapNullable (
154
+
{ relative_path, sha256, ... }:
156
+
url = "https://developer.download.nvidia.com/compute/${redistName}/redist/${relative_path}";
159
+
) (redistribRelease.${redistArch} or null);
162
+
# Pkg-config's setup hook expects configuration files in $out/share/pkgconfig
164
+
for path in pkg-config pkgconfig; do
165
+
[[ -d "$path" ]] || continue
166
+
mkdir -p share/pkgconfig
167
+
mv "$path"/* share/pkgconfig/
171
+
# Rewrite FHS paths with store paths
172
+
# NOTE: output* fall back to out if the corresponding output isn't defined.
174
+
for pc in share/pkgconfig/*.pc; do
176
+
-e "s|^cudaroot\s*=.*\$|cudaroot=''${!outputDev}|" \
177
+
-e "s|^libdir\s*=.*/lib\$|libdir=''${!outputLib}/lib|" \
178
+
-e "s|^includedir\s*=.*/include\$|includedir=''${!outputDev}/include|" \
182
+
# Generate unversioned names.
# E.g. cuda-11.8.pc -> cuda.pc
175
-
for pc in share/pkgconfig/*-"$majorMinorVersion.pc" ; do
176
-
ln -s "$(basename "$pc")" "''${pc%-$majorMinorVersion.pc}".pc
185
+
for pc in share/pkgconfig/*-"$majorMinorVersion.pc"; do
186
+
ln -s "$(basename "$pc")" "''${pc%-$majorMinorVersion.pc}".pc
env.majorMinorVersion = cudaMajorMinorVersion;
···
# Handle the existence of libPath, which requires us to re-arrange the lib directory
+ strings.optionalString (libPath != null) ''
full_lib_path="lib/${libPath}"
237
-
if [[ ! -d "$full_lib_path" ]] ; then
247
+
if [[ ! -d "$full_lib_path" ]]; then
echo "${finalAttrs.pname}: '$full_lib_path' does not exist, only found:" >&2
find lib/ -mindepth 1 -maxdepth 1 >&2
echo "This release might not support your CUDA version" >&2
···
echo "Executing postInstallCheck"
268
-
if [[ -z "''${allowFHSReferences-}" ]] ; then
278
+
if [[ -z "''${allowFHSReferences-}" ]]; then
mapfile -t outputPaths < <(for o in $(getAllOutputNames); do echo "''${!o}"; done)
270
-
if grep --max-count=5 --recursive --exclude=LICENSE /usr/ "''${outputPaths[@]}" ; then
280
+
if grep --max-count=5 --recursive --exclude=LICENSE /usr/ "''${outputPaths[@]}"; then
echo "Detected references to /usr" >&2