1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs synced 2024-10-19 03:47:13 -04:00
nixpkgs/pkgs/build-support/opengl/mesa-switch.sh

42 lines
1.2 KiB
Bash
Raw Normal View History

profileName=opengl
profileDir=/nix/var/nix/profiles
profile=$profileDir/$profileName
if test -z "$OPENGL_DRIVER"; then
if test -d "$profile/lib"; then
OPENGL_DRIVER=$profile
fi
fi
if test -z "$OPENGL_DRIVER"; then
cat <<EOF
======================================================================
This program uses OpenGL for 3D graphics. For best performance, you
should use a hardware-accelerated implementation of OpenGL. Since you
have not enabled one, a software implementation (Mesa) will be used.
This will probably be quite slow.
This program will look for a hardware-accelerated implementation of
OpenGL in the "$profileName" profile of your Nix installation. For
instance, to enable NVidia's accelerated driver on non-NixOS systems,
try
$ nix-env -p $profile -i nvidia-sys-opengl
Alternatively, you can set the OPENGL_DRIVER environment variable to
point at the package containing the OpenGL implementation.
======================================================================
EOF
OPENGL_DRIVER=$mesa
fi
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH${LD_LIBRARY_PATH:+:}$OPENGL_DRIVER/lib
hook="$OPENGL_DRIVER/nix-support/opengl-hook"
if test -e "$hook"; then
source "$hook"
fi