nixpkgs/pkgs/tools/X11/primus/default.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

46 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,
stdenv_i686,
lib,
primusLib,
writeScriptBin,
runtimeShell,
primusLib_i686 ? null,
useNvidia ? true,
}:
let
# 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; };
ldPath = lib.makeLibraryPath (
lib.filter (x: x != null) (
[
primus
primus.glvnd
]
++ lib.optionals (primusLib_i686 != null) [
primus_i686
primus_i686.glvnd
]
)
);
in
writeScriptBin "primusrun" ''
#!${runtimeShell}
export LD_LIBRARY_PATH=${ldPath}''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH
# https://bugs.launchpad.net/ubuntu/+source/bumblebee/+bug/1758243
export __GLVND_DISALLOW_PATCHING=1
exec "$@"
''