2014-05-03 15:28:21 +01:00
|
|
|
# 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
|
2016-03-31 17:51:15 +01:00
|
|
|
, stdenv_i686
|
2017-01-29 21:29:39 +00:00
|
|
|
, lib
|
2014-05-03 15:28:21 +01:00
|
|
|
, primusLib
|
2015-12-04 21:31:10 +00:00
|
|
|
, writeScriptBin
|
2019-02-26 11:45:54 +00:00
|
|
|
, runtimeShell
|
2014-05-03 15:28:21 +01:00
|
|
|
, primusLib_i686 ? null
|
2015-12-04 21:31:10 +00:00
|
|
|
, useNvidia ? true
|
2014-05-03 15:28:21 +01:00
|
|
|
}:
|
2015-12-04 21:31:10 +00:00
|
|
|
|
2014-05-03 15:28:21 +01:00
|
|
|
let
|
2016-03-31 17:51:15 +01:00
|
|
|
# We override stdenv in case we need different ABI for libGL
|
|
|
|
primusLib_ = primusLib.override { inherit stdenv; };
|
|
|
|
primusLib_i686_ = primusLib_i686.override { stdenv = stdenv_i686; };
|
|
|
|
|
|
|
|
primus = if useNvidia then primusLib_ else primusLib_.override { nvidia_x11 = null; };
|
|
|
|
primus_i686 = if useNvidia then primusLib_i686_ else primusLib_i686_.override { nvidia_x11 = null; };
|
2017-03-08 20:07:15 +00:00
|
|
|
ldPath = lib.makeLibraryPath (lib.filter (x: x != null) (
|
|
|
|
[ primus primus.glvnd ]
|
|
|
|
++ lib.optionals (primusLib_i686 != null) [ primus_i686 primus_i686.glvnd ]
|
|
|
|
));
|
2015-12-04 21:31:10 +00:00
|
|
|
|
|
|
|
in writeScriptBin "primusrun" ''
|
2019-02-26 11:45:54 +00:00
|
|
|
#!${runtimeShell}
|
2015-03-09 20:01:32 +00:00
|
|
|
export LD_LIBRARY_PATH=${ldPath}:$LD_LIBRARY_PATH
|
2019-07-17 09:44:00 +01:00
|
|
|
# https://bugs.launchpad.net/ubuntu/+source/bumblebee/+bug/1758243
|
|
|
|
export __GLVND_DISALLOW_PATCHING=1
|
2014-05-03 15:28:21 +01:00
|
|
|
exec "$@"
|
2015-12-04 21:31:10 +00:00
|
|
|
''
|