2014-05-03 16:28:21 +02: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
|
|
|
|
, primusLib
|
2015-12-04 22:31:10 +01:00
|
|
|
, writeScriptBin
|
2014-05-03 16:28:21 +02:00
|
|
|
, primusLib_i686 ? null
|
2015-12-04 22:31:10 +01:00
|
|
|
, useNvidia ? true
|
2014-05-03 16:28:21 +02:00
|
|
|
}:
|
2015-12-04 22:31:10 +01:00
|
|
|
|
2014-05-03 16:28:21 +02:00
|
|
|
let
|
2015-12-04 22:31:10 +01:00
|
|
|
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; };
|
|
|
|
ldPath = stdenv.lib.makeLibraryPath ([primus] ++ stdenv.lib.optional (primusLib_i686 != null) primus_i686);
|
|
|
|
|
|
|
|
in writeScriptBin "primusrun" ''
|
|
|
|
#!${stdenv.shell}
|
2015-03-09 21:01:32 +01:00
|
|
|
export LD_LIBRARY_PATH=${ldPath}:$LD_LIBRARY_PATH
|
2014-05-03 16:28:21 +02:00
|
|
|
exec "$@"
|
2015-12-04 22:31:10 +01:00
|
|
|
''
|