nixpkgs/pkgs/tools/X11/primus/default.nix
Corey O'Connor b2f3e10a35 Add primus and extend bumblebee to support 32bit/64bit multilib architectures.
Using primusrun will work as expected in a multilib environment. Even if the initial program
executes a antoehr program of the another architecture. Assuming the program does not modify
LD_LIBRARY_PATH inappropriately.

This does not update virtualgl for seemless multilib. I was unable to get a mixed 64/32 bit
environment to work with VirtualGL. The mechanism VirtualGL uses to inject the fake GL library would
fail if both 32bit and 64 bit libraries were in the environment. Instead the bumblebee package
creates a optirun32 executable that can be used to run a 32bit executable with optimus on a 64 bit
host. This is not created if the host is 32bit.

For my usage, gaming under wine, the primusrun executable works as expected regardless of
32bit/64bit.
2014-11-29 16:42:00 -08:00

41 lines
1.3 KiB
Nix

# For a 64bit + 32bit system the LD_LIBRARY_PATH must contain both the 32bit and 64bit primus
# libraries. Providing a different primusrun for each architecture will not work as expected. EG:
# Using steam under wine can involve both 32bit and 64bit process. All of which inherit the
# same LD_LIBRARY_PATH.
# Other distributions do the same.
{ stdenv
, primusLib
, writeScript
, primusLib_i686 ? null
}:
with stdenv.lib;
let
version = "1.0.0748176";
ldPath = makeLibraryPath ([primusLib] ++ optional (primusLib_i686 != null) primusLib_i686);
primusrun = writeScript "primusrun"
''
export LD_LIBRARY_PATH=${ldPath}:\$LD_LIBRARY_PATH
# see: https://github.com/amonakov/primus/issues/138
# On my system, as of 3.16.6, the intel driver dies when the pixel buffers try to read from the
# source memory directly. Setting PRIMUS_UPLOAD causes an indirection through textures which
# avoids this issue.
export PRIMUS_UPLOAD=1
exec "$@"
'';
in
stdenv.mkDerivation {
name = "primus-${version}";
builder = writeScript "builder"
''
source $stdenv/setup
mkdir -p $out/bin
cp ${primusrun} $out/bin/primusrun
'';
meta = {
homepage = https://github.com/amonakov/primus;
description = "Faster OpenGL offloading for Bumblebee";
maintainer = maintainers.coconnor;
};
}