steam: include steam-runtime within chroot

This commit is contained in:
Christoph Hrdinka 2015-08-06 20:21:43 +02:00 committed by Nikolay Amiantov
parent 3bd78123f3
commit 2f52c62684

View file

@ -1,122 +1,150 @@
{ lib, buildFHSUserEnv
{ lib, buildFHSUserEnv, steam-runtime
, withRuntime ? false
, withJava ? false
, withPrimus ? false
, withJava ? false
, withPrimus ? false
}:
buildFHSUserEnv {
name = "steam";
targetPkgs = pkgs:
[ pkgs.steam-original
targetPkgs = pkgs: with pkgs; [
steam-original
# Errors in output without those
pkgs.pciutils
pkgs.python2
pciutils
python2
# Games' dependencies
pkgs.xlibs.xrandr
pkgs.which
xlibs.xrandr
which
# needed by gdialog, including in the steam-runtime
perl
]
++ lib.optional withJava pkgs.jdk
++ lib.optional withPrimus pkgs.primus
++ lib.optional withJava jdk
++ lib.optional withPrimus primus
;
multiPkgs = pkgs: [
multiPkgs = pkgs: with pkgs; [
# These are required by steam with proper errors
pkgs.xlibs.libXcomposite
pkgs.xlibs.libXtst
pkgs.xlibs.libXrandr
pkgs.xlibs.libXext
pkgs.xlibs.libX11
pkgs.xlibs.libXfixes
xlibs.libXcomposite
xlibs.libXtst
xlibs.libXrandr
xlibs.libXext
xlibs.libX11
xlibs.libXfixes
pkgs.glib
pkgs.gtk2
pkgs.bzip2
pkgs.zlib
pkgs.libpulseaudio
pkgs.gdk_pixbuf
glib
gtk2
bzip2
zlib
libpulseaudio
gdk_pixbuf
# Not formally in runtime but needed by some games
pkgs.gst_all_1.gstreamer
pkgs.gst_all_1.gst-plugins-ugly
gst_all_1.gstreamer
gst_all_1.gst-plugins-ugly
] ++ lib.optionals withRuntime [
# Without these it silently fails
pkgs.xlibs.libXinerama
pkgs.xlibs.libXdamage
pkgs.xlibs.libXcursor
pkgs.xlibs.libXrender
pkgs.xlibs.libXScrnSaver
pkgs.xlibs.libXi
pkgs.xlibs.libSM
pkgs.xlibs.libICE
pkgs.gnome2.GConf
pkgs.freetype
pkgs.openalSoft
pkgs.curl
pkgs.nspr
pkgs.nss
pkgs.fontconfig
pkgs.cairo
pkgs.pango
pkgs.alsaLib
pkgs.expat
pkgs.dbus
pkgs.cups
pkgs.libcap
pkgs.SDL2
pkgs.libusb1
pkgs.dbus_glib
pkgs.libav
pkgs.atk
xlibs.libXinerama
xlibs.libXdamage
xlibs.libXcursor
xlibs.libXrender
xlibs.libXScrnSaver
xlibs.libXi
xlibs.libSM
xlibs.libICE
gnome2.GConf
freetype
openalSoft
curl
nspr
nss
fontconfig
cairo
pango
alsaLib
expat
dbus
cups
libcap
SDL2
libusb1
dbus_glib
libav
atk
# Only libraries are needed from those two
pkgs.udev182
pkgs.networkmanager098
udev182
networkmanager098
# Verified games requirements
pkgs.xlibs.libXmu
pkgs.xlibs.libxcb
pkgs.xlibs.libpciaccess
pkgs.mesa_glu
pkgs.libuuid
pkgs.libogg
pkgs.libvorbis
pkgs.SDL
pkgs.SDL2_image
pkgs.glew110
pkgs.openssl
pkgs.libidn
xlibs.libXmu
xlibs.libxcb
xlibs.libpciaccess
mesa_glu
libuuid
libogg
libvorbis
SDL
SDL2_image
glew110
openssl
libidn
# Other things from runtime
pkgs.xlibs.libXinerama
pkgs.flac
pkgs.freeglut
pkgs.libjpeg
pkgs.libpng12
pkgs.libsamplerate
pkgs.libmikmod
pkgs.libtheora
pkgs.pixman
pkgs.speex
pkgs.SDL_image
pkgs.SDL_ttf
pkgs.SDL_mixer
pkgs.SDL2_net
pkgs.SDL2_ttf
pkgs.SDL2_mixer
pkgs.gstreamer
pkgs.gst_plugins_base
xlibs.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
];
extraBuildCommands = ''
[ -d lib64 ] && mv lib64/steam lib
# FIXME: maybe we should replace this with proper libcurl-gnutls
( cd lib; ln -s libcurl.so.4 libcurl-gnutls.so.4 )
[ -d lib64 ] && ( cd lib64; ln -s libcurl.so.4 libcurl-gnutls.so.4 )
ln -s libcurl.so.4 lib/libcurl-gnutls.so.4
[ -d lib64 ] && ln -s libcurl.so.4 lib64/libcurl-gnutls.so.4
'' + lib.optionals withRuntime ''
mkdir -p steamrt/usr
ln -s lib32 steamrt/lib
if [ -d lib64 ]; then
ln -s ${steam-runtime}/i386/usr/bin steamrt/bin
else
ln -s ${steam-runtime}/amd64/usr/bin steamrt/bin
fi
ln -s ${steam-runtime}/i386/etc steamrt/etc
ln -s ${steam-runtime}/i386/usr/include steamrt/usr/include
cp -rsf --no-preserve mode ${steam-runtime}/i386/usr/lib steamrt/lib32
cp -rsf ${steam-runtime}/i386/lib/* steamrt/lib32
cp -rsf --no-preserve mode ${steam-runtime}/amd64/usr/lib steamrt/lib64
cp -rsf ${steam-runtime}/amd64/lib/* steamrt/lib64
libs=$(ls -dm --quoting-style=escape steamrt/lib{32,64}/{,*/})
echo 'export STEAM_RUNTIME=0' > steamrt/profile
echo 'export PATH=$PATH:/steamrt/bin' >> steamrt/profile
echo -n 'export LD_LIBRARY_PATH=/' >> steamrt/profile
echo -n $libs | sed 's/\/, /:\//g' | sed 's/\/$//g' >> steamrt/profile
echo ':$LD_LIBRARY_PATH' >> steamrt/profile
'';
profile = if withRuntime then ''
export STEAM_RUNTIME=0
source /steamrt/profile
'' else ''
# Ugly workaround for https://github.com/ValveSoftware/steam-for-linux/issues/3504
export LD_PRELOAD=/lib32/libpulse.so:/lib64/libpulse.so:/lib32/libasound.so:/lib64/libasound.so:$LD_PRELOAD