From 2fd1b95fad27331307bfd14bda731e5997d60908 Mon Sep 17 00:00:00 2001 From: wchresta <34962284+wchresta@users.noreply.github.com> Date: Sat, 30 Dec 2017 21:06:09 +0100 Subject: [PATCH 1/2] steam: add wrapper testing for libGL NixOS: Failing to set hardware.opengl.driSupport32Bit will lead to a confusing error message about missing libGL.so.1. We include a wrapper around the steam bin to test for working 32bit opengl with glxinfo. When failing, we display a proper warning hinting towards the option. Fixes: #19518 --- pkgs/games/steam/chrootenv.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/games/steam/chrootenv.nix b/pkgs/games/steam/chrootenv.nix index a7392bbc34e..019b1577e15 100644 --- a/pkgs/games/steam/chrootenv.nix +++ b/pkgs/games/steam/chrootenv.nix @@ -69,6 +69,9 @@ in buildFHSUserEnv rec { xlibs.libX11 xlibs.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 @@ -103,7 +106,15 @@ in buildFHSUserEnv rec { export TZDIR=/etc/zoneinfo ''; - runScript = "steam"; + runScript = writeScript "steam-wrapper.sh" '' + #!${stdenv.shell} + glxinfo >/dev/null 2>&1 + if [ ! "$?" = "0" ]; then + echo "*** WARNING: Test for 32-bit libGL unsuccessful." + echo " This could mean you forgot to activate hardware.opengl.driSupport32Bit" + fi + steam + ''; passthru.run = buildFHSUserEnv { name = "steam-run"; From f4c9cc6878ee262730833a98d7fa55cbb29601ac Mon Sep 17 00:00:00 2001 From: wchresta <34962284+wchresta@users.noreply.github.com> Date: Sun, 31 Dec 2017 11:43:21 +0100 Subject: [PATCH 2/2] steam: Check for NixOS, improve error message --- pkgs/games/steam/chrootenv.nix | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pkgs/games/steam/chrootenv.nix b/pkgs/games/steam/chrootenv.nix index 019b1577e15..49d786284da 100644 --- a/pkgs/games/steam/chrootenv.nix +++ b/pkgs/games/steam/chrootenv.nix @@ -108,10 +108,21 @@ in buildFHSUserEnv rec { runScript = writeScript "steam-wrapper.sh" '' #!${stdenv.shell} - glxinfo >/dev/null 2>&1 - if [ ! "$?" = "0" ]; then - echo "*** WARNING: Test for 32-bit libGL unsuccessful." - echo " This could mean you forgot to activate hardware.opengl.driSupport32Bit" + if [ -f /host/etc/NIXOS ]; then # Check only useful on NixOS + 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 + ** + WARNING: Steam is not set up. Add the following options to /etc/nixos/configuration.nix + and then run \`sudo nixos-rebuild switch\`: + { + hardware.opengl.driSupport32Bit = true; + hardware.pulseaudio.support32Bit = true; + } + ** + EOF + fi fi steam '';