forked from mirrors/nixpkgs
410f21887a
in /usr/lib/libGL.so.1 (which will typically load a driver in /usr/X11R6/lib/modules/dri). This has been tested on a i915 graphics card; it should work with most open source X.org drivers. For NVidia's proprietary drivers (which we cannot build ourselves anyway), some more symlinks are necessary; I'll add those later. So to get hardware-accelerated Quake 3, do: $ nix-env -p /nix/var/nix/profiles/opengl -i xorg-sys-opengl $ nix-env -i quake3-demo $ quake3 svn path=/nixpkgs/trunk/; revision=4613
42 lines
1.2 KiB
Bash
42 lines
1.2 KiB
Bash
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 the (hopefully) accelerated driver provided by
|
|
your (non-NixOS) Linux distribution, try
|
|
|
|
$ nix-env -p $profile -i xorg-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
|