git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit9c8137ca81fec5db81e0b9dc28055fa02548eeae authorNikolay Amiantov <ab@fmap.me> dateFri 16 Mar 2018, 02:37 (9 years ago) parenta4a0452
3 files changed+107−101
pkgs/games/steam/chrootenv.nix+100−14 pkgs/games/steam/default.nix+1 pkgs/games/steam/runtime-wrapped.nix+6−87
pkgs/games/steam/chrootenv.nix+100−14
@@ -1,4 +1,4 @@
1−{ stdenv, lib, writeScript, buildFHSUserEnv, steam
1+{ stdenv, lib, writeScript, buildFHSUserEnv, steam, glxinfo-i686
22, steam-runtime-wrapped, steam-runtime-wrapped-i686 ? null
33, withJava ? false
44, withPrimus ? false
@@ -58,9 +58,6 @@ in buildFHSUserEnv rec {
5858 xorg.libX11
5959 xorg.libXfixes
6060
61− # Needed to properly check for libGL.so.1 in steam-wrapper.sh
62− pkgsi686Linux.glxinfo
63−
6461 # Not formally in runtime but needed by some games
6562 gst_all_1.gstreamer
6663 gst_all_1.gst-plugins-ugly
@@ -68,19 +65,104 @@ in buildFHSUserEnv rec {
6865 mono
6966 xorg.xkeyboardconfig
7067 xorg.libpciaccess
71−
68+ ] ++ (if (!nativeOnly) then [
7269 (steamPackages.steam-runtime-wrapped.override {
73− inherit nativeOnly runtimeOnly;
70+ inherit runtimeOnly;
7471 })
75− ];
76−
77− extraBuildCommands = ''
72+ ] else [
73+ # Required
74+ glib
75+ gtk2
76+ bzip2
77+ zlib
78+ gdk_pixbuf
79+
80+ # Without these it silently fails
81+ xorg.libXinerama
82+ xorg.libXdamage
83+ xorg.libXcursor
84+ xorg.libXrender
85+ xorg.libXScrnSaver
86+ xorg.libXxf86vm
87+ xorg.libXi
88+ xorg.libSM
89+ xorg.libICE
90+ gnome2.GConf
91+ freetype
92+ (curl.override { gnutlsSupport = true; sslSupport = false; })
93+ nspr
94+ nss
95+ fontconfig
96+ cairo
97+ pango
98+ expat
99+ dbus
100+ cups
101+ libcap
102+ SDL2
103+ libusb1
104+ dbus-glib
105+ libav
106+ atk
107+ # Only libraries are needed from those two
108+ libudev0-shim
109+ networkmanager098
110+
111+ # Verified games requirements
112+ xorg.libXmu
113+ xorg.libxcb
114+ libGLU
115+ libuuid
116+ libogg
117+ libvorbis
118+ SDL
119+ SDL2_image
120+ glew110
121+ openssl
122+ libidn
123+ tbb
124+
125+ # Other things from runtime
126+ flac
127+ freeglut
128+ libjpeg
129+ libpng12
130+ libsamplerate
131+ libmikmod
132+ libtheora
133+ libtiff
134+ pixman
135+ speex
136+ SDL_image
137+ SDL_ttf
138+ SDL_mixer
139+ SDL2_ttf
140+ SDL2_mixer
141+ gstreamer
142+ gst-plugins-base
143+ libGLU
144+ libappindicator-gtk2
145+ libcaca
146+ libcanberra
147+ libgcrypt
148+ libvpx
149+ librsvg
150+ xorg.libXft
151+ libvdpau
152+ ] ++ steamPackages.steam-runtime-wrapped.overridePkgs);
153+
154+ extraBuildCommands = if (!nativeOnly) then ''
78155 mkdir -p steamrt
79156 ln -s ../lib/steam-runtime steamrt/${steam-runtime-wrapped.arch}
80157 ${lib.optionalString (steam-runtime-wrapped-i686 != null) ''
81158 ln -s ../lib32/steam-runtime steamrt/${steam-runtime-wrapped-i686.arch}
82159 ''}
83160 ln -s ${runSh} steamrt/run.sh
161+ '' else ''
162+ ln -s /usr/lib/libbz2.so usr/lib/libbz2.so.1.0
163+ ${lib.optionalString (steam-runtime-wrapped-i686 != null) ''
164+ ln -s /usr/lib32/libbz2.so usr/lib32/libbz2.so.1.0
165+ ''}
84166 '';
85167
86168 extraInstallCommands = ''
@@ -91,13 +173,13 @@ in buildFHSUserEnv rec {
91173 '';
92174
93175 profile = ''
94− export STEAM_RUNTIME=/steamrt
176+ export STEAM_RUNTIME=${if nativeOnly then "0" else "/steamrt"}
95177 '';
96178
97179 runScript = writeScript "steam-wrapper.sh" ''
98180 #!${stdenv.shell}
99181 if [ -f /host/etc/NIXOS ]; then # Check only useful on NixOS
100− glxinfo >/dev/null 2>&1
182+ ${glxinfo-i686}/bin/glxinfo >/dev/null 2>&1
101183 # If there was an error running glxinfo, we know something is wrong with the configuration
102184 if [ $? -ne 0 ]; then
103185 cat <<EOF > /dev/stderr
@@ -112,9 +194,13 @@ in buildFHSUserEnv rec {
112194 EOF
113195 fi
114196 fi
115− steam
197+ exec steam "$@"
116198 '';
117199
200+ meta = steam.meta // {
201+ broken = nativeOnly;
202+ };
203+
118204 passthru.run = buildFHSUserEnv {
119205 name = "steam-run";
120206
@@ -129,8 +215,8 @@ in buildFHSUserEnv rec {
129215 exit 1
130216 fi
131217 shift
132− export LD_LIBRARY_PATH=${lib.concatStringsSep ":" ldPath}:$LD_LIBRARY_PATH
133− exec "$run" "$@"
218+ ${lib.optionalString (!nativeOnly) "export LD_LIBRARY_PATH=${lib.concatStringsSep ":" ldPath}:$LD_LIBRARY_PATH"}
219+ exec -- "$run" "$@"
134220 '';
135221 };
136222}
pkgs/games/steam/default.nix+1
@@ -13,6 +13,7 @@ let
1313 steam = callPackage ./steam.nix { };
1414 steam-fonts = callPackage ./fonts.nix { };
1515 steam-chrootenv = callPackage ./chrootenv.nix {
16+ glxinfo-i686 = pkgs.pkgsi686Linux.glxinfo;
1617 steam-runtime-wrapped-i686 =
1718 if steamArch == "amd64"
1819 then pkgs.pkgsi686Linux.steamPackages.steam-runtime-wrapped
pkgs/games/steam/runtime-wrapped.nix+6−87
@@ -1,103 +1,22 @@
11{ stdenv, steamArch, lib, perl, pkgs, steam-runtime
2−, nativeOnly ? false
32, runtimeOnly ? false
43}:
54
6−assert !(nativeOnly && runtimeOnly);
7−
85let
9− runtimePkgs = with pkgs; [
10− # Required
11− glib
12− gtk2
13− bzip2
14− zlib
15− gdk_pixbuf
16−
17− # Without these it silently fails
18− xorg.libXinerama
19− xorg.libXdamage
20− xorg.libXcursor
21− xorg.libXrender
22− xorg.libXScrnSaver
23− xorg.libXxf86vm
24− xorg.libXi
25− xorg.libSM
26− xorg.libICE
27− gnome2.GConf
28− freetype
29− (curl.override { gnutlsSupport = true; sslSupport = false; })
30− nspr
31− nss
32− fontconfig
33− cairo
34− pango
35− expat
36− dbus
37− cups
38− libcap
39− SDL2
40− libusb1
41− dbus-glib
42− libav
43− atk
44− # Only libraries are needed from those two
45− libudev0-shim
46− networkmanager098
47−
48− # Verified games requirements
49− xorg.libXmu
50− xorg.libxcb
51− libGLU
52− libuuid
53− libogg
54− libvorbis
55− SDL
56− SDL2_image
57− glew110
58− openssl
59− libidn
60− tbb
61−
62− # Other things from runtime
63− xorg.libXinerama
64− flac
65− freeglut
66− libjpeg
67− libpng12
68− libsamplerate
69− libmikmod
70− libtheora
71− pixman
72− speex
73− SDL_image
74− SDL_ttf
75− SDL_mixer
76− SDL2_net
77− SDL2_ttf
78− SDL2_mixer
79− gstreamer
80− gst-plugins-base
81− ];
82−
83− overridePkgs = with pkgs; [
6+ overridePkgs = lib.optionals (!runtimeOnly) (with pkgs; [
847 libgpgerror
858 libpulseaudio
869 alsaLib
8710 openalSoft
88− libva
11+ libva1-full
12+ libvdpau
8913 vulkan-loader
9014 gcc.cc
9115 nss
9216 nspr
93− ];
94−
95− ourRuntime = if runtimeOnly then []
96− else if nativeOnly then runtimePkgs ++ overridePkgs
97− else overridePkgs;
98− steamRuntime = lib.optional (!nativeOnly) steam-runtime;
17+ ]);
9918
100− allPkgs = ourRuntime ++ steamRuntime;
19+ allPkgs = overridePkgs ++ [ steam-runtime ];
10120
10221 gnuArch = if steamArch == "amd64" then "x86_64-linux-gnu"
10322 else if steamArch == "i386" then "i386-linux-gnu"
@@ -114,7 +33,7 @@ in stdenv.mkDerivation rec {
11433 builder = ./build-wrapped.sh;
11534
11635 passthru = {
117− inherit gnuArch libs bins;
36+ inherit gnuArch libs bins overridePkgs;
11837 arch = steamArch;
11938 };
12039