From 9c8137ca81fec5db81e0b9dc28055fa02548eeae Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Fri, 16 Mar 2018 02:37:42 +0300 Subject: steam: improvements for native runtime * Update dependencies using steam-native-runtime from Arch Linux as a reference. * Remove native-only Steam Runtime, just use installed libraries instead. * Mark native-only Steam as broken (due to segfault inside D-Bus). Seems it was already broken for a long time. Doesn't apply to steam-run. * Some cleanups for chrootenv. --- pkgs/games/steam/chrootenv.nix | 114 ++++++++++++++++++++++++++++++----- pkgs/games/steam/default.nix | 1 + pkgs/games/steam/runtime-wrapped.nix | 93 ++-------------------------- 3 files changed, 107 insertions(+), 101 deletions(-) (limited to 'pkgs/games/steam') diff --git a/pkgs/games/steam/chrootenv.nix b/pkgs/games/steam/chrootenv.nix index 88cde7331767..ce6e86c50b8f 100644 --- a/pkgs/games/steam/chrootenv.nix +++ b/pkgs/games/steam/chrootenv.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, writeScript, buildFHSUserEnv, steam +{ stdenv, lib, writeScript, buildFHSUserEnv, steam, glxinfo-i686 , steam-runtime-wrapped, steam-runtime-wrapped-i686 ? null , withJava ? false , withPrimus ? false @@ -58,9 +58,6 @@ in buildFHSUserEnv rec { xorg.libX11 xorg.libXfixes - # Needed to properly check for libGL.so.1 in steam-wrapper.sh - pkgsi686Linux.glxinfo - # Not formally in runtime but needed by some games gst_all_1.gstreamer gst_all_1.gst-plugins-ugly @@ -68,19 +65,104 @@ in buildFHSUserEnv rec { mono xorg.xkeyboardconfig xorg.libpciaccess - + ] ++ (if (!nativeOnly) then [ (steamPackages.steam-runtime-wrapped.override { - inherit nativeOnly runtimeOnly; + inherit runtimeOnly; }) - ]; - - extraBuildCommands = '' + ] else [ + # Required + glib + gtk2 + bzip2 + zlib + gdk_pixbuf + + # Without these it silently fails + xorg.libXinerama + xorg.libXdamage + xorg.libXcursor + xorg.libXrender + xorg.libXScrnSaver + xorg.libXxf86vm + xorg.libXi + xorg.libSM + xorg.libICE + gnome2.GConf + freetype + (curl.override { gnutlsSupport = true; sslSupport = false; }) + nspr + nss + fontconfig + cairo + pango + expat + dbus + cups + libcap + SDL2 + libusb1 + dbus-glib + libav + atk + # Only libraries are needed from those two + libudev0-shim + networkmanager098 + + # Verified games requirements + xorg.libXmu + xorg.libxcb + libGLU + libuuid + libogg + libvorbis + SDL + SDL2_image + glew110 + openssl + libidn + tbb + + # Other things from runtime + flac + freeglut + libjpeg + libpng12 + libsamplerate + libmikmod + libtheora + libtiff + pixman + speex + SDL_image + SDL_ttf + SDL_mixer + SDL2_ttf + SDL2_mixer + gstreamer + gst-plugins-base + libGLU + libappindicator-gtk2 + libcaca + libcanberra + libgcrypt + libvpx + librsvg + xorg.libXft + libvdpau + ] ++ steamPackages.steam-runtime-wrapped.overridePkgs); + + extraBuildCommands = if (!nativeOnly) then '' mkdir -p steamrt ln -s ../lib/steam-runtime steamrt/${steam-runtime-wrapped.arch} ${lib.optionalString (steam-runtime-wrapped-i686 != null) '' ln -s ../lib32/steam-runtime steamrt/${steam-runtime-wrapped-i686.arch} ''} ln -s ${runSh} steamrt/run.sh + '' else '' + ln -s /usr/lib/libbz2.so usr/lib/libbz2.so.1.0 + ${lib.optionalString (steam-runtime-wrapped-i686 != null) '' + ln -s /usr/lib32/libbz2.so usr/lib32/libbz2.so.1.0 + ''} ''; extraInstallCommands = '' @@ -91,13 +173,13 @@ in buildFHSUserEnv rec { ''; profile = '' - export STEAM_RUNTIME=/steamrt + export STEAM_RUNTIME=${if nativeOnly then "0" else "/steamrt"} ''; runScript = writeScript "steam-wrapper.sh" '' #!${stdenv.shell} if [ -f /host/etc/NIXOS ]; then # Check only useful on NixOS - glxinfo >/dev/null 2>&1 + ${glxinfo-i686}/bin/glxinfo >/dev/null 2>&1 # If there was an error running glxinfo, we know something is wrong with the configuration if [ $? -ne 0 ]; then cat < /dev/stderr @@ -112,9 +194,13 @@ in buildFHSUserEnv rec { EOF fi fi - steam + exec steam "$@" ''; + meta = steam.meta // { + broken = nativeOnly; + }; + passthru.run = buildFHSUserEnv { name = "steam-run"; @@ -129,8 +215,8 @@ in buildFHSUserEnv rec { exit 1 fi shift - export LD_LIBRARY_PATH=${lib.concatStringsSep ":" ldPath}:$LD_LIBRARY_PATH - exec "$run" "$@" + ${lib.optionalString (!nativeOnly) "export LD_LIBRARY_PATH=${lib.concatStringsSep ":" ldPath}:$LD_LIBRARY_PATH"} + exec -- "$run" "$@" ''; }; } diff --git a/pkgs/games/steam/default.nix b/pkgs/games/steam/default.nix index 6a6485d43319..b7dbba552698 100644 --- a/pkgs/games/steam/default.nix +++ b/pkgs/games/steam/default.nix @@ -13,6 +13,7 @@ let steam = callPackage ./steam.nix { }; steam-fonts = callPackage ./fonts.nix { }; steam-chrootenv = callPackage ./chrootenv.nix { + glxinfo-i686 = pkgs.pkgsi686Linux.glxinfo; steam-runtime-wrapped-i686 = if steamArch == "amd64" then pkgs.pkgsi686Linux.steamPackages.steam-runtime-wrapped diff --git a/pkgs/games/steam/runtime-wrapped.nix b/pkgs/games/steam/runtime-wrapped.nix index 5412a1be5187..b3746a50c777 100644 --- a/pkgs/games/steam/runtime-wrapped.nix +++ b/pkgs/games/steam/runtime-wrapped.nix @@ -1,103 +1,22 @@ { stdenv, steamArch, lib, perl, pkgs, steam-runtime -, nativeOnly ? false , runtimeOnly ? false }: -assert !(nativeOnly && runtimeOnly); - let - runtimePkgs = with pkgs; [ - # Required - glib - gtk2 - bzip2 - zlib - gdk_pixbuf - - # Without these it silently fails - xorg.libXinerama - xorg.libXdamage - xorg.libXcursor - xorg.libXrender - xorg.libXScrnSaver - xorg.libXxf86vm - xorg.libXi - xorg.libSM - xorg.libICE - gnome2.GConf - freetype - (curl.override { gnutlsSupport = true; sslSupport = false; }) - nspr - nss - fontconfig - cairo - pango - expat - dbus - cups - libcap - SDL2 - libusb1 - dbus-glib - libav - atk - # Only libraries are needed from those two - libudev0-shim - networkmanager098 - - # Verified games requirements - xorg.libXmu - xorg.libxcb - libGLU - libuuid - libogg - libvorbis - SDL - SDL2_image - glew110 - openssl - libidn - tbb - - # Other things from runtime - xorg.libXinerama - flac - freeglut - libjpeg - libpng12 - libsamplerate - libmikmod - libtheora - pixman - speex - SDL_image - SDL_ttf - SDL_mixer - SDL2_net - SDL2_ttf - SDL2_mixer - gstreamer - gst-plugins-base - ]; - - overridePkgs = with pkgs; [ + overridePkgs = lib.optionals (!runtimeOnly) (with pkgs; [ libgpgerror libpulseaudio alsaLib openalSoft - libva + libva1-full + libvdpau vulkan-loader gcc.cc nss nspr - ]; - - ourRuntime = if runtimeOnly then [] - else if nativeOnly then runtimePkgs ++ overridePkgs - else overridePkgs; - steamRuntime = lib.optional (!nativeOnly) steam-runtime; + ]); - allPkgs = ourRuntime ++ steamRuntime; + allPkgs = overridePkgs ++ [ steam-runtime ]; gnuArch = if steamArch == "amd64" then "x86_64-linux-gnu" else if steamArch == "i386" then "i386-linux-gnu" @@ -114,7 +33,7 @@ in stdenv.mkDerivation rec { builder = ./build-wrapped.sh; passthru = { - inherit gnuArch libs bins; + inherit gnuArch libs bins overridePkgs; arch = steamArch; }; -- cgit 1.4.1