nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 33 lines 869 B view raw
1# shellcheck shell=bash 2# Patch all dynamically linked, ELF files with the CUDA driver (libcuda.so) 3# coming from the cuda_compat package by adding it to the RUNPATH. 4echo "Sourcing auto-add-cuda-compat-runpath-hook" 5 6# shellcheck disable=SC2157 7if [[ -z "@libcudaPath@" ]]; then 8 echo "auto-add-cuda-compat-runpath-hook: cuda_compat not available, skipping hook" 9 return 10fi 11 12addCudaCompatRunpath() { 13 local libPath 14 local origRpath 15 16 if [[ $# -eq 0 ]]; then 17 nixLog "no library path provided" >&2 18 exit 1 19 elif [[ $# -gt 1 ]]; then 20 nixLog "too many arguments" >&2 21 exit 1 22 elif [[ $1 == "" ]]; then 23 nixLog "empty library path" >&2 24 exit 1 25 else 26 libPath="$1" 27 fi 28 29 origRpath="$(patchelf --print-rpath "$libPath")" 30 patchelf --set-rpath "@libcudaPath@:$origRpath" "$libPath" 31} 32 33postFixupHooks+=("autoFixElfFiles addCudaCompatRunpath")