summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2006-01-28 01:13:31 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2006-01-28 01:13:31 +0000
commit410f21887ac624f0336a87fa56a0780dd3c673ae (patch)
tree2a12dda1626b62a795e85faae74636bce954855a /pkgs
parent7f74c406c4dab2a4aa9c3c818c14f59b3d28829d (diff)
downloadnixpkgs-410f21887ac624f0336a87fa56a0780dd3c673ae.tar
nixpkgs-410f21887ac624f0336a87fa56a0780dd3c673ae.tar.gz
nixpkgs-410f21887ac624f0336a87fa56a0780dd3c673ae.tar.bz2
nixpkgs-410f21887ac624f0336a87fa56a0780dd3c673ae.tar.lz
nixpkgs-410f21887ac624f0336a87fa56a0780dd3c673ae.tar.xz
nixpkgs-410f21887ac624f0336a87fa56a0780dd3c673ae.tar.zst
nixpkgs-410f21887ac624f0336a87fa56a0780dd3c673ae.zip
* A quick hack to get accelerated OpenGL working: just use the driver
  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
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/build-support/opengl/mesa-switch.sh6
-rw-r--r--pkgs/os-specific/linux/opengl/xorg-sys/builder.sh9
-rw-r--r--pkgs/os-specific/linux/opengl/xorg-sys/default.nix15
-rw-r--r--pkgs/system/all-packages-generic.nix4
-rw-r--r--pkgs/system/populate-cache.nix1
5 files changed, 32 insertions, 3 deletions
diff --git a/pkgs/build-support/opengl/mesa-switch.sh b/pkgs/build-support/opengl/mesa-switch.sh
index bc9445319dd..8dcabc07dea 100644
--- a/pkgs/build-support/opengl/mesa-switch.sh
+++ b/pkgs/build-support/opengl/mesa-switch.sh
@@ -19,10 +19,10 @@ 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
+instance, to enable the (hopefully) accelerated driver provided by
+your (non-NixOS) Linux distribution, try
 
-  $ nix-env -p $profile -i nvidia-sys-opengl
+  $ 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.
diff --git a/pkgs/os-specific/linux/opengl/xorg-sys/builder.sh b/pkgs/os-specific/linux/opengl/xorg-sys/builder.sh
new file mode 100644
index 00000000000..3894dbd207f
--- /dev/null
+++ b/pkgs/os-specific/linux/opengl/xorg-sys/builder.sh
@@ -0,0 +1,9 @@
+source $stdenv/setup
+
+ensureDir $out/lib
+
+ln -s /usr/lib/libGL.so.1 $out/lib/
+
+for i in $neededLibs; do
+    ln -s $i/lib/*.so* $out/lib/
+done
diff --git a/pkgs/os-specific/linux/opengl/xorg-sys/default.nix b/pkgs/os-specific/linux/opengl/xorg-sys/default.nix
new file mode 100644
index 00000000000..ae348b70c69
--- /dev/null
+++ b/pkgs/os-specific/linux/opengl/xorg-sys/default.nix
@@ -0,0 +1,15 @@
+# This is a very dirty hack to allow hardware acceleration of OpenGL
+# applications for most (?) users.  It will use the driver that your
+# Linux distribution installed in /usr/lib/libGL.so.1.  Hopefully,
+# this driver uses hardware acceleration.
+#
+# Of course, use of the driver in /usr/lib is highly impure.  But it
+# might actually work ;-)
+
+{stdenv, xlibs, expat}:
+
+stdenv.mkDerivation {
+  name = "xorg-sys-opengl";
+  builder = ./builder.sh;
+  neededLibs = [xlibs.libXxf86vm expat];
+}
diff --git a/pkgs/system/all-packages-generic.nix b/pkgs/system/all-packages-generic.nix
index 631051f43da..143b47c2bdf 100644
--- a/pkgs/system/all-packages-generic.nix
+++ b/pkgs/system/all-packages-generic.nix
@@ -1681,6 +1681,10 @@ rec {
     inherit fetchurl stdenv;
   };
 
+  xorg_sys_opengl = import ../os-specific/linux/opengl/xorg-sys {
+    inherit stdenv xlibs expat;
+  };
+
   
   ### DATA
 
diff --git a/pkgs/system/populate-cache.nix b/pkgs/system/populate-cache.nix
index c5146391a75..bac38c88204 100644
--- a/pkgs/system/populate-cache.nix
+++ b/pkgs/system/populate-cache.nix
@@ -130,6 +130,7 @@ let {
     jetty
 
     quake3demo
+    xorg_sys_opengl
   ;};
 
   i686FreeBSDPkgs = {inherit (allPackages {system = "i686-freebsd";})