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.
This commit is contained in:
Nikolay Amiantov 2018-03-16 02:37:42 +03:00
parent a4a04528e4
commit 9c8137ca81
3 changed files with 106 additions and 100 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, lib, writeScript, buildFHSUserEnv, steam { stdenv, lib, writeScript, buildFHSUserEnv, steam, glxinfo-i686
, steam-runtime-wrapped, steam-runtime-wrapped-i686 ? null , steam-runtime-wrapped, steam-runtime-wrapped-i686 ? null
, withJava ? false , withJava ? false
, withPrimus ? false , withPrimus ? false
@ -58,9 +58,6 @@ in buildFHSUserEnv rec {
xorg.libX11 xorg.libX11
xorg.libXfixes 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 # Not formally in runtime but needed by some games
gst_all_1.gstreamer gst_all_1.gstreamer
gst_all_1.gst-plugins-ugly gst_all_1.gst-plugins-ugly
@ -68,19 +65,104 @@ in buildFHSUserEnv rec {
mono mono
xorg.xkeyboardconfig xorg.xkeyboardconfig
xorg.libpciaccess xorg.libpciaccess
] ++ (if (!nativeOnly) then [
(steamPackages.steam-runtime-wrapped.override { (steamPackages.steam-runtime-wrapped.override {
inherit nativeOnly runtimeOnly; inherit runtimeOnly;
}) })
]; ] else [
# Required
glib
gtk2
bzip2
zlib
gdk_pixbuf
extraBuildCommands = '' # 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 mkdir -p steamrt
ln -s ../lib/steam-runtime steamrt/${steam-runtime-wrapped.arch} ln -s ../lib/steam-runtime steamrt/${steam-runtime-wrapped.arch}
${lib.optionalString (steam-runtime-wrapped-i686 != null) '' ${lib.optionalString (steam-runtime-wrapped-i686 != null) ''
ln -s ../lib32/steam-runtime steamrt/${steam-runtime-wrapped-i686.arch} ln -s ../lib32/steam-runtime steamrt/${steam-runtime-wrapped-i686.arch}
''} ''}
ln -s ${runSh} steamrt/run.sh 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 = '' extraInstallCommands = ''
@ -91,13 +173,13 @@ in buildFHSUserEnv rec {
''; '';
profile = '' profile = ''
export STEAM_RUNTIME=/steamrt export STEAM_RUNTIME=${if nativeOnly then "0" else "/steamrt"}
''; '';
runScript = writeScript "steam-wrapper.sh" '' runScript = writeScript "steam-wrapper.sh" ''
#!${stdenv.shell} #!${stdenv.shell}
if [ -f /host/etc/NIXOS ]; then # Check only useful on NixOS 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 there was an error running glxinfo, we know something is wrong with the configuration
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
cat <<EOF > /dev/stderr cat <<EOF > /dev/stderr
@ -112,9 +194,13 @@ in buildFHSUserEnv rec {
EOF EOF
fi fi
fi fi
steam exec steam "$@"
''; '';
meta = steam.meta // {
broken = nativeOnly;
};
passthru.run = buildFHSUserEnv { passthru.run = buildFHSUserEnv {
name = "steam-run"; name = "steam-run";
@ -129,8 +215,8 @@ in buildFHSUserEnv rec {
exit 1 exit 1
fi fi
shift shift
export LD_LIBRARY_PATH=${lib.concatStringsSep ":" ldPath}:$LD_LIBRARY_PATH ${lib.optionalString (!nativeOnly) "export LD_LIBRARY_PATH=${lib.concatStringsSep ":" ldPath}:$LD_LIBRARY_PATH"}
exec "$run" "$@" exec -- "$run" "$@"
''; '';
}; };
} }

View File

@ -13,6 +13,7 @@ let
steam = callPackage ./steam.nix { }; steam = callPackage ./steam.nix { };
steam-fonts = callPackage ./fonts.nix { }; steam-fonts = callPackage ./fonts.nix { };
steam-chrootenv = callPackage ./chrootenv.nix { steam-chrootenv = callPackage ./chrootenv.nix {
glxinfo-i686 = pkgs.pkgsi686Linux.glxinfo;
steam-runtime-wrapped-i686 = steam-runtime-wrapped-i686 =
if steamArch == "amd64" if steamArch == "amd64"
then pkgs.pkgsi686Linux.steamPackages.steam-runtime-wrapped then pkgs.pkgsi686Linux.steamPackages.steam-runtime-wrapped

View File

@ -1,103 +1,22 @@
{ stdenv, steamArch, lib, perl, pkgs, steam-runtime { stdenv, steamArch, lib, perl, pkgs, steam-runtime
, nativeOnly ? false
, runtimeOnly ? false , runtimeOnly ? false
}: }:
assert !(nativeOnly && runtimeOnly);
let let
runtimePkgs = with pkgs; [ overridePkgs = lib.optionals (!runtimeOnly) (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; [
libgpgerror libgpgerror
libpulseaudio libpulseaudio
alsaLib alsaLib
openalSoft openalSoft
libva libva1-full
libvdpau
vulkan-loader vulkan-loader
gcc.cc gcc.cc
nss nss
nspr nspr
]; ]);
ourRuntime = if runtimeOnly then [] allPkgs = overridePkgs ++ [ steam-runtime ];
else if nativeOnly then runtimePkgs ++ overridePkgs
else overridePkgs;
steamRuntime = lib.optional (!nativeOnly) steam-runtime;
allPkgs = ourRuntime ++ steamRuntime;
gnuArch = if steamArch == "amd64" then "x86_64-linux-gnu" gnuArch = if steamArch == "amd64" then "x86_64-linux-gnu"
else if steamArch == "i386" then "i386-linux-gnu" else if steamArch == "i386" then "i386-linux-gnu"
@ -114,7 +33,7 @@ in stdenv.mkDerivation rec {
builder = ./build-wrapped.sh; builder = ./build-wrapped.sh;
passthru = { passthru = {
inherit gnuArch libs bins; inherit gnuArch libs bins overridePkgs;
arch = steamArch; arch = steamArch;
}; };