mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-02 11:03:57 +00:00
571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
30 lines
1.1 KiB
Bash
30 lines
1.1 KiB
Bash
# Set RUNPATH so that driver libraries in /run/opengl-driver(-32)/lib can be found.
|
|
# This is needed to not rely on LD_LIBRARY_PATH which does not work with setuid
|
|
# executables. Fixes https://github.com/NixOS/nixpkgs/issues/22760. It must be run
|
|
# in postFixup because RUNPATH stripping in fixup would undo it. Note that patchelf
|
|
# actually sets RUNPATH not RPATH, which applies only to dependencies of the binary
|
|
# it set on (including for dlopen), so the RUNPATH must indeed be set on these
|
|
# libraries and would not work if set only on executables.
|
|
addDriverRunpath() {
|
|
local forceRpath=
|
|
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
--) shift; break;;
|
|
--force-rpath) shift; forceRpath=1;;
|
|
--*)
|
|
echo "addDriverRunpath: ERROR: Invalid command line" \
|
|
"argument: $1" >&2
|
|
return 1;;
|
|
*) break;;
|
|
esac
|
|
done
|
|
|
|
for file in "$@"; do
|
|
if ! isELF "$file"; then continue; fi
|
|
local origRpath="$(patchelf --print-rpath "$file")"
|
|
patchelf --set-rpath "@driverLink@/lib:$origRpath" ${forceRpath:+--force-rpath} "$file"
|
|
done
|
|
}
|
|
|