From ca2ce98720afc154a78c8e47d441c28ac42be864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sat, 18 Feb 2023 15:39:54 +0100 Subject: [PATCH 1/3] steam-fhs: remove deprecated options --- pkgs/games/steam/fhsenv.nix | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/pkgs/games/steam/fhsenv.nix b/pkgs/games/steam/fhsenv.nix index 7d496a5ec969..d31f33779961 100644 --- a/pkgs/games/steam/fhsenv.nix +++ b/pkgs/games/steam/fhsenv.nix @@ -1,16 +1,9 @@ -{ config, lib, writeScript, buildFHSUserEnv, steam, glxinfo-i686 +{ lib, stdenv, writeScript, buildFHSUserEnv, steam, glxinfo-i686, runtimeShell , steam-runtime-wrapped, steam-runtime-wrapped-i686 ? null , extraPkgs ? pkgs: [ ] # extra packages to add to targetPkgs , extraLibraries ? pkgs: [ ] # extra packages to add to multiPkgs , extraProfile ? "" # string to append to profile , extraArgs ? "" # arguments to always pass to steam -, runtimeOnly ? false -, runtimeShell -, stdenv - -# DEPRECATED -, withJava ? config.steam.java or false -, withPrimus ? config.steam.primus or false }: let @@ -38,9 +31,7 @@ let # electron based launchers need newer versions of these libraries than what runtime provides mesa sqlite - ] ++ lib.optional withJava jdk8 # TODO: upgrade https://github.com/NixOS/nixpkgs/pull/89731 - ++ lib.optional withPrimus primus - ++ extraPkgs pkgs; + ] ++ extraPkgs pkgs; ldPath = lib.optionals stdenv.is64bit [ "/lib64" ] ++ [ "/lib32" ] From ad815aebfbfe1415ff6436521d545029c803c3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sat, 18 Feb 2023 16:02:22 +0100 Subject: [PATCH 2/3] steam: cleanup --- pkgs/games/steam/fhsenv.nix | 48 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/pkgs/games/steam/fhsenv.nix b/pkgs/games/steam/fhsenv.nix index d31f33779961..5ffa4c826287 100644 --- a/pkgs/games/steam/fhsenv.nix +++ b/pkgs/games/steam/fhsenv.nix @@ -7,31 +7,30 @@ }: let - commonTargetPkgs = pkgs: with pkgs; - [ - # Needed for operating system detection until - # https://github.com/ValveSoftware/steam-for-linux/issues/5909 is resolved - lsb-release - # Errors in output without those - pciutils - # Games' dependencies - xorg.xrandr - which - # Needed by gdialog, including in the steam-runtime - perl - # Open URLs - xdg-utils - iana-etc - # Steam Play / Proton - python3 - # Steam VR - procps - usbutils + commonTargetPkgs = pkgs: with pkgs; [ + # Needed for operating system detection until + # https://github.com/ValveSoftware/steam-for-linux/issues/5909 is resolved + lsb-release + # Errors in output without those + pciutils + # Games' dependencies + xorg.xrandr + which + # Needed by gdialog, including in the steam-runtime + perl + # Open URLs + xdg-utils + iana-etc + # Steam Play / Proton + python3 + # Steam VR + procps + usbutils - # electron based launchers need newer versions of these libraries than what runtime provides - mesa - sqlite - ] ++ extraPkgs pkgs; + # electron based launchers need newer versions of these libraries than what runtime provides + mesa + sqlite + ] ++ extraPkgs pkgs; ldPath = lib.optionals stdenv.is64bit [ "/lib64" ] ++ [ "/lib32" ] @@ -273,7 +272,6 @@ in buildFHSUserEnv rec { targetPkgs = commonTargetPkgs; inherit multiPkgs profile extraInstallCommands; - inherit unshareIpc unsharePid; runScript = writeScript "steam-run" '' From a62d444697933940052260f1fe86ace6df52c14b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sat, 18 Feb 2023 16:02:35 +0100 Subject: [PATCH 3/3] steam-small: init A steam variant without game specific libraries to have a smaller footprint on systems where people don't need or want the full blown fhs. --- pkgs/games/steam/default.nix | 3 +- pkgs/games/steam/fhsenv.nix | 114 ++++++++++++++++---------------- pkgs/top-level/all-packages.nix | 1 + 3 files changed, 59 insertions(+), 59 deletions(-) diff --git a/pkgs/games/steam/default.nix b/pkgs/games/steam/default.nix index 9dfb239620e4..9e7b815661c9 100644 --- a/pkgs/games/steam/default.nix +++ b/pkgs/games/steam/default.nix @@ -5,7 +5,7 @@ let steamPackagesFun = self: let inherit (self) callPackage; - in { + in rec { steamArch = if stdenv.hostPlatform.system == "x86_64-linux" then "amd64" else if stdenv.hostPlatform.system == "i686-linux" then "i386" else throw "Unsupported platform: ${stdenv.hostPlatform.system}"; @@ -21,6 +21,7 @@ let else null; inherit buildFHSUserEnv; }; + steam-fhsenv-small = steam-fhsenv.override { withGameSpecificLibraries = false; }; steamcmd = callPackage ./steamcmd.nix { }; }; keep = self: { }; diff --git a/pkgs/games/steam/fhsenv.nix b/pkgs/games/steam/fhsenv.nix index 5ffa4c826287..c50176dce790 100644 --- a/pkgs/games/steam/fhsenv.nix +++ b/pkgs/games/steam/fhsenv.nix @@ -4,6 +4,7 @@ , extraLibraries ? pkgs: [ ] # extra packages to add to multiPkgs , extraProfile ? "" # string to append to profile , extraArgs ? "" # arguments to always pass to steam +, withGameSpecificLibraries ? true # exclude game specific libraries }: let @@ -77,52 +78,8 @@ in buildFHSUserEnv rec { libthai pango - # Not formally in runtime but needed by some games - at-spi2-atk - at-spi2-core # CrossCode - gst_all_1.gstreamer - gst_all_1.gst-plugins-ugly - gst_all_1.gst-plugins-base - json-glib # paradox launcher (Stellaris) - libdrm - libxkbcommon # paradox launcher - libvorbis # Dead Cells - libxcrypt # Alien Isolation, XCOM 2, Company of Heroes 2 - mono - xorg.xkeyboardconfig - xorg.libpciaccess - xorg.libXScrnSaver # Dead Cells - udev # shadow of the tomb raider - icu # dotnet runtime, e.g. stardew valley - - # screeps dependencies - gtk3 - dbus - zlib - atk - cairo - freetype - gdk-pixbuf - fontconfig - - # friends options won't display "Launch Game" without it - lsof - - # called by steam's setup.sh - file - - # Prison Architect - libGLU - libuuid - libbsd - alsa-lib - - # Loop Hero - libidn2 - libpsl - nghttp2.lib - openssl_1_1 - rtmpdump + lsof # friends options won't display "Launch Game" without it + file # called by steam's setup.sh # dependencies for mesa drivers, needed inside pressure-vessel mesa.llvmPackages.llvm.lib @@ -134,14 +91,7 @@ in buildFHSUserEnv rec { xorg.libxshmfence xorg.libXxf86vm libelf - - # pressure-vessel (required for mangohud and possibly more) - elfutils.out - - # Required - glib - gtk2 - bzip2 + (lib.getLib elfutils) # Without these it silently fails xorg.libXinerama @@ -161,10 +111,11 @@ in buildFHSUserEnv rec { libusb1 dbus-glib ffmpeg - # Only libraries are needed from those two libudev0-shim # Verified games requirements + fontconfig + freetype xorg.libXt xorg.libXmu libogg @@ -172,10 +123,15 @@ in buildFHSUserEnv rec { SDL SDL2_image glew110 + libdrm libidn tbb + zlib # Other things from runtime + glib + gtk2 + bzip2 flac freeglut libjpeg @@ -202,8 +158,48 @@ in buildFHSUserEnv rec { librsvg xorg.libXft libvdpau - ] - ++ steamPackages.steam-runtime-wrapped.overridePkgs + ] ++ lib.optionals withGameSpecificLibraries [ + # Not formally in runtime but needed by some games + at-spi2-atk + at-spi2-core # CrossCode + gst_all_1.gstreamer + gst_all_1.gst-plugins-ugly + gst_all_1.gst-plugins-base + json-glib # paradox launcher (Stellaris) + libdrm + libxkbcommon # paradox launcher + libvorbis # Dead Cells + libxcrypt # Alien Isolation, XCOM 2, Company of Heroes 2 + mono + xorg.xkeyboardconfig + xorg.libpciaccess + xorg.libXScrnSaver # Dead Cells + udev # Shadow of the Tomb Raider + icu # dotnet runtime, e.g. Stardew Valley + + # screeps dependencies + gtk3 + dbus + zlib + atk + cairo + freetype + gdk-pixbuf + fontconfig + + # Prison Architect + libGLU + libuuid + libbsd + alsa-lib + + # Loop Hero + libidn2 + libpsl + nghttp2.lib + openssl_1_1 + rtmpdump + ] ++ steamPackages.steam-runtime-wrapped.overridePkgs ++ extraLibraries pkgs; extraInstallCommands = '' @@ -256,7 +252,9 @@ in buildFHSUserEnv rec { exec steam ${extraArgs} "$@" ''; - inherit (steam) meta; + meta = steam.meta // lib.optionalAttrs (!withGameSpecificLibraries) { + description = steam.meta.description + " (without game specific libraries)"; + }; # allows for some gui applications to share IPC # this fixes certain issues where they don't render correctly diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1f46e94edd40..148c545d0623 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -35759,6 +35759,7 @@ with pkgs; }); steam = steamPackages.steam-fhsenv; + steam-small = steamPackages.steam-fhsenv-small; steam-run = steam.run;