Skip to content

Commit

Permalink
steam: add /steamrt/run.sh
Browse files Browse the repository at this point in the history
This is needed for Steam Beta which expects run.sh to print runtime library
paths.

Fixes #31384.
  • Loading branch information
abbradar committed Nov 11, 2017
1 parent cbfb586 commit 459e4b7
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions pkgs/games/steam/chrootenv.nix
Expand Up @@ -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";

Expand Down Expand Up @@ -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 = ''
Expand All @@ -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" "$@"
'';
};
}

0 comments on commit 459e4b7

Please sign in to comment.