summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2017-11-11 15:51:12 +0300
committerNikolay Amiantov <ab@fmap.me>2017-11-11 15:52:33 +0300
commit459e4b78db754872dfbd741e9f136d8998ffcaff (patch)
treeeae98bbd0f50d337917bbd38d35239216a597c88 /pkgs/games
parentcbfb586151c929fc63f2f15621d3bb6dc2dda95b (diff)
downloadnixlib-459e4b78db754872dfbd741e9f136d8998ffcaff.tar
nixlib-459e4b78db754872dfbd741e9f136d8998ffcaff.tar.gz
nixlib-459e4b78db754872dfbd741e9f136d8998ffcaff.tar.bz2
nixlib-459e4b78db754872dfbd741e9f136d8998ffcaff.tar.lz
nixlib-459e4b78db754872dfbd741e9f136d8998ffcaff.tar.xz
nixlib-459e4b78db754872dfbd741e9f136d8998ffcaff.tar.zst
nixlib-459e4b78db754872dfbd741e9f136d8998ffcaff.zip
steam: add /steamrt/run.sh
This is needed for Steam Beta which expects run.sh to print runtime library
paths.

Fixes #31384.
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/steam/chrootenv.nix40
1 files 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" "$@"
+    '';
   };
 }