Skip to content

Commit

Permalink
cudaPackages: __structuredAttrs works with autoPatchelf since NixOS#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
Connor Baker committed Jan 16, 2024
1 parent b020963 commit c86b13e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
13 changes: 8 additions & 5 deletions pkgs/development/cuda-modules/cuda/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
final.pkgs.rdma-core
];
# Before 11.7 libcufile depends on itself for some reason.
env.autoPatchelfIgnoreMissingDeps =
prevAttrs.env.autoPatchelfIgnoreMissingDeps
+ strings.optionalString (cudaVersionOlder "11.7") " libcufile.so.0";
autoPatchelfIgnoreMissingDeps =
prevAttrs.autoPatchelfIgnoreMissingDeps
++ lists.optionals (cudaVersionOlder "11.7") [ "libcufile.so.0" ];
}
);

Expand Down Expand Up @@ -69,8 +69,11 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {

cuda_compat = prev.cuda_compat.overrideAttrs (
prevAttrs: {
env.autoPatchelfIgnoreMissingDeps =
prevAttrs.env.autoPatchelfIgnoreMissingDeps + " libnvrm_gpu.so libnvrm_mem.so libnvdla_runtime.so";
autoPatchelfIgnoreMissingDeps = prevAttrs.autoPatchelfIgnoreMissingDeps ++ [
"libnvrm_gpu.so"
"libnvrm_mem.so"
"libnvdla_runtime.so"
];
# `cuda_compat` only works on aarch64-linux, and only when building for Jetson devices.
badPlatformsConditions = prevAttrs.badPlatformsConditions // {
"Trying to use cuda_compat on aarch64-linux targeting non-Jetson devices" =
Expand Down
9 changes: 4 additions & 5 deletions pkgs/development/cuda-modules/generic-builders/manifest.nix
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,10 @@ backendStdenv.mkDerivation (
'';

# libcuda needs to be resolved during runtime
# NOTE: Due to the use of __structuredAttrs, we can't use a list for autoPatchelfIgnoreMissingDeps, since it
# will take only the first value. Instead, we produce a string with the values separated by spaces.
# Using the `env` attribute ensures that the value is representable as one of the primitives allowed by
# bash's environment variables.
env.autoPatchelfIgnoreMissingDeps = "libcuda.so libcuda.so.*";
autoPatchelfIgnoreMissingDeps = [
"libcuda.so"
"libcuda.so.*"
];

# The out output leverages the same functionality which backs the `symlinkJoin` function in
# Nixpkgs:
Expand Down

0 comments on commit c86b13e

Please sign in to comment.