From 459e4b78db754872dfbd741e9f136d8998ffcaff Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Sat, 11 Nov 2017 15:51:12 +0300 Subject: [PATCH] steam: add /steamrt/run.sh This is needed for Steam Beta which expects run.sh to print runtime library paths. Fixes #31384. --- pkgs/games/steam/chrootenv.nix | 40 ++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/pkgs/games/steam/chrootenv.nix b/pkgs/games/steam/chrootenv.nix index d9263d2c2f5e..a7392bbc34e9 100644 --- a/pkgs/games/steam/chrootenv.nix +++ b/pkgs/games/steam/chrootenv.nix @@ -37,6 +37,20 @@ let ++ lib.optional withPrimus primus ++ extraPkgs pkgs; + ldPath = map (x: "/steamrt/${steam-runtime-wrapped.arch}/" + x) steam-runtime-wrapped.libs + ++ lib.optionals (steam-runtime-wrapped-i686 != null) (map (x: "/steamrt/${steam-runtime-wrapped-i686.arch}/" + x) steam-runtime-wrapped-i686.libs); + + runSh = writeScript "run.sh" '' + #!${stdenv.shell} + runtime_paths="${lib.concatStringsSep ":" ldPath}" + if [ "$1" == "--print-steam-runtime-library-paths" ]; then + echo "$runtime_paths" + exit 0 + fi + export LD_LIBRARY_PATH="$runtime_paths:$LD_LIBRARY_PATH" + exec "$@" + ''; + in buildFHSUserEnv rec { name = "steam"; @@ -74,6 +88,7 @@ in buildFHSUserEnv rec { ${lib.optionalString (steam-runtime-wrapped-i686 != null) '' ln -s ../lib32/steam-runtime steamrt/${steam-runtime-wrapped-i686.arch} ''} + ln -s ${runSh} steamrt/run.sh ''; extraInstallCommands = '' @@ -96,19 +111,16 @@ in buildFHSUserEnv rec { targetPkgs = commonTargetPkgs; inherit multiPkgs extraBuildCommands; - runScript = - let ldPath = map (x: "/steamrt/${steam-runtime-wrapped.arch}/" + x) steam-runtime-wrapped.libs - ++ lib.optionals (steam-runtime-wrapped-i686 != null) (map (x: "/steamrt/${steam-runtime-wrapped-i686.arch}/" + x) steam-runtime-wrapped-i686.libs); - in writeScript "steam-run" '' - #!${stdenv.shell} - run="$1" - if [ "$run" = "" ]; then - echo "Usage: steam-run command-to-run args..." >&2 - exit 1 - fi - shift - export LD_LIBRARY_PATH=${lib.concatStringsSep ":" ldPath}:$LD_LIBRARY_PATH - exec "$run" "$@" - ''; + runScript = writeScript "steam-run" '' + #!${stdenv.shell} + run="$1" + if [ "$run" = "" ]; then + echo "Usage: steam-run command-to-run args..." >&2 + exit 1 + fi + shift + export LD_LIBRARY_PATH=${lib.concatStringsSep ":" ldPath}:$LD_LIBRARY_PATH + exec "$run" "$@" + ''; }; }