From 2ae2326435f3eb40a0aa8ab0e7d876376796d9da Mon Sep 17 00:00:00 2001 From: John Kehayias Date: Sun, 22 Oct 2023 14:16:40 -0400 Subject: [PATCH 1/8] nonguix: multiarch-container: Remove pressure-vessel workaround. Setting $PRESSURE_VESSEL_FILESYSTEMS_RO to "/gnu/store" is no longer needed for Steam as the fix has been merged upstream. Users can still set this environment variable (preserved in the container) if needed. * nonguix/multiarch-container.scm (make-container-wrapper): Remove setting $PRESSURE_VESSEL_FILESYSTEMS_RO. --- nonguix/multiarch-container.scm | 5 ----- 1 file changed, 5 deletions(-) diff --git a/nonguix/multiarch-container.scm b/nonguix/multiarch-container.scm index 6bb1916..8f92e6d 100644 --- a/nonguix/multiarch-container.scm +++ b/nonguix/multiarch-container.scm @@ -320,11 +320,6 @@ in a sandboxed FHS environment." (args (cdr (command-line))) (command (if DEBUG '() `("--" ,run ,@args)))) - ;; TODO: Remove once upstream change is merged and in stable pressure-vessel - ;; (although may want to hold off for anyone using older pressure-vessel versions - ;; for whatever reason), see: - ;; https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/merge_requests/406 - (setenv "PRESSURE_VESSEL_FILESYSTEMS_RO" "/gnu/store") ;; By default VDPAU drivers are searched for in libvdpau's store ;; path, so set this path to where the drivers will actually be ;; located in the container. From 9e99a4dc6f1070b1119fea07053ec0f121d6ea53 Mon Sep 17 00:00:00 2001 From: John Kehayias Date: Sun, 22 Oct 2023 14:31:50 -0400 Subject: [PATCH 2/8] nonguix: multiarch-container: Set LD_LIBRARY_PATH (for steam). Setting $LD_LIBRARY_PATH in the container allows for non-Steam games added to Steam to launch properly with Proton. Otherwise they don't make it to the pressure-vessel container as it seems they start in an environment where the rest of our setup is not active (e.g. game will fail to launch with an error about being unable to load libGL.so.1). * nonguix/multiarch-container.scm (make-container-wrapper): Preserve LD_LIBRARY_PATH and set it. --- nonguix/multiarch-container.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nonguix/multiarch-container.scm b/nonguix/multiarch-container.scm index 8f92e6d..ae04482 100644 --- a/nonguix/multiarch-container.scm +++ b/nonguix/multiarch-container.scm @@ -260,6 +260,17 @@ in a sandboxed FHS environment." "^DISPLAY$" "^DRI_PRIME$" "^GDK_SCALE$" ; For UI scaling. + ;; For startup of added non-Steam games as it + ;; seems they start in an early environment + ;; before our additional settings. (Likely + ;; this can be removed when rewritten to use + ;; --emulate-fhs from upstream.) Note that + ;; this is explicitly set below. We could + ;; preserve what is set before launching the + ;; container, but any such directories would + ;; need to be shared with the container as + ;; well; this is not needed currently. + "^LD_LIBRARY_PATH$" "^PRESSURE_VESSEL_" ; For pressure vessel options. "_PROXY$" "_proxy$" @@ -320,6 +331,10 @@ in a sandboxed FHS environment." (args (cdr (command-line))) (command (if DEBUG '() `("--" ,run ,@args)))) + ;; Set this so that e.g. non-Steam games added to Steam will launch + ;; properly. It seems otherwise they don't make it to launching + ;; Steam's pressure-vessel container (for Proton games). + (setenv "LD_LIBRARY_PATH" "/lib64:/lib") ;; By default VDPAU drivers are searched for in libvdpau's store ;; path, so set this path to where the drivers will actually be ;; located in the container. From 18db7ec1afc610e609e8856dbc807eef6d79bfea Mon Sep 17 00:00:00 2001 From: John Kehayias Date: Sun, 22 Oct 2023 14:42:26 -0400 Subject: [PATCH 3/8] nonguix: multiarch-container: Preserve MANGOHUD. Now one can have set MANGOHUD=1 in their environment to have all Steam games launch with MangoHud, rather than always setting this per game launch settings. Likewise for MANGOHUD_CONFIG for configuration. * nonguix/multiarch-container.scm (make-container-wrapper): Preserve MANGOHUD environment variables. --- nonguix/multiarch-container.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/nonguix/multiarch-container.scm b/nonguix/multiarch-container.scm index ae04482..6c146cf 100644 --- a/nonguix/multiarch-container.scm +++ b/nonguix/multiarch-container.scm @@ -271,6 +271,7 @@ in a sandboxed FHS environment." ;; need to be shared with the container as ;; well; this is not needed currently. "^LD_LIBRARY_PATH$" + "^MANGOHUD" ; For MangoHud configuration. "^PRESSURE_VESSEL_" ; For pressure vessel options. "_PROXY$" "_proxy$" From bc0921a7bc18959b4a3ff6e51f0eca997f6f93ed Mon Sep 17 00:00:00 2001 From: John Kehayias Date: Sun, 22 Oct 2023 14:50:40 -0400 Subject: [PATCH 4/8] nonguix: multiarch-container: Make locale usable by pressure-vessel. Steam's pressure-vessel startup time can be improved by not having to generate locales. So make sure locales are in and used by the pressure-vessel container by linking the expected location of /usr/lib/locale (presumably so that pressure-vessel will capture them) and setting $GUIX_LOCPATH. * nonguix/multiarch-container.scm (make-container-wrapper): Preserve and set GUIX_LOCPATH. (make-internal-script): Add symlink for /usr/lib/locale. --- nonguix/multiarch-container.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nonguix/multiarch-container.scm b/nonguix/multiarch-container.scm index 6c146cf..b333b71 100644 --- a/nonguix/multiarch-container.scm +++ b/nonguix/multiarch-container.scm @@ -260,6 +260,7 @@ in a sandboxed FHS environment." "^DISPLAY$" "^DRI_PRIME$" "^GDK_SCALE$" ; For UI scaling. + "^GUIX_LOCPATH$" ; For pressure-vessel locales. ;; For startup of added non-Steam games as it ;; seems they start in an early environment ;; before our additional settings. (Likely @@ -336,6 +337,11 @@ in a sandboxed FHS environment." ;; properly. It seems otherwise they don't make it to launching ;; Steam's pressure-vessel container (for Proton games). (setenv "LD_LIBRARY_PATH" "/lib64:/lib") + ;; Set this so Steam's pressure-vessel container does not need to + ;; generate locales, improving startup time. This needs to be set to + ;; the "usual" path, probably so they are included in the + ;; pressure-vessel container. + (setenv "GUIX_LOCPATH" "/usr/lib/locale") ;; By default VDPAU drivers are searched for in libvdpau's store ;; path, so set this path to where the drivers will actually be ;; located in the container. @@ -474,6 +480,7 @@ application." '("/run/current-system/profile/etc" "/run/current-system/profile/share" "/sbin" + "/usr/lib" "/usr/share/vulkan/icd.d")) (for-each new-symlink @@ -491,6 +498,9 @@ application." ((,union64 "lib") . "/lib64") ((,union64 "lib") . "/run/current-system/profile/lib64") ((,union64 "lib/locale") . "/run/current-system/locale") + ;; Despite using GUIX_LOCPATH, stil need locales in their + ;; expected location for pressure-vessel to use them. + ((,union64 "lib/locale") . "/usr/lib/locale") ((,union64 "sbin/ldconfig") . "/sbin/ldconfig") ((,union64 "share/mime") . "/usr/share/mime") ; Steam tray icon. ((,union64 "share/drirc.d") . "/usr/share/drirc.d") From 3da4fa5d288ae74fdb7797c5576490fa14ab90ee Mon Sep 17 00:00:00 2001 From: John Kehayias Date: Sun, 22 Oct 2023 15:49:16 -0400 Subject: [PATCH 5/8] [DRAFT] nongnu: Add mesa-next. * nongnu/packages/steam-client.scm (mesa-next): New variable. (mesa-fixed): Remove variable. --- nongnu/packages/steam-client.scm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/nongnu/packages/steam-client.scm b/nongnu/packages/steam-client.scm index e7592cf..db71ab0 100644 --- a/nongnu/packages/steam-client.scm +++ b/nongnu/packages/steam-client.scm @@ -120,13 +120,25 @@ (modify-inputs (package-propagated-inputs libxdamage) (replace "libx11" libx11-fixed))))) -(define mesa-fixed +(define-public mesa-next (package (inherit mesa) (propagated-inputs (modify-inputs (package-propagated-inputs mesa) (replace "libx11" libx11-fixed) - (replace "libxdamage" libxdamage-fixed))))) + (replace "libxdamage" libxdamage-fixed))) + (name "mesa-next") + (version "23.2.1") + (source + (origin + (method url-fetch) + (uri (list (string-append "https://archive.mesa3d.org/" + "mesa-" version ".tar.xz") + (string-append "ftp://ftp.freedesktop.org/pub/mesa/" + "mesa-" version ".tar.xz"))) + (sha256 + (base32 + "1k61pgw0vcjrlb4299q98cy7iqmk2r7jmb5ika91z01dzhb0dpk4")))))) (define steam-client-libs `(("bash" ,bash) ; Required for steam startup. From 46c8b08cd6adf442dec43dc7f9a1033842e49bbc Mon Sep 17 00:00:00 2001 From: John Kehayias Date: Sun, 22 Oct 2023 15:51:01 -0400 Subject: [PATCH 6/8] [DRAFT] nongnu: Add mesa-git. * nongnu/packages/steam-client.scm (mesa-git): New variable. --- nongnu/packages/steam-client.scm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/nongnu/packages/steam-client.scm b/nongnu/packages/steam-client.scm index db71ab0..befcd0b 100644 --- a/nongnu/packages/steam-client.scm +++ b/nongnu/packages/steam-client.scm @@ -140,6 +140,23 @@ (base32 "1k61pgw0vcjrlb4299q98cy7iqmk2r7jmb5ika91z01dzhb0dpk4")))))) +(define-public mesa-git + (let ((commit "9f4f52f4f3466ba4570f163c869fc1c04b21e5c9") + (revision "0")) + (package + (inherit mesa-next) + (name "mesa-git") + (version (git-version "23.3.0-devel" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://gitlab.freedesktop.org/mesa/mesa") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "17s2kyf0dsmvi7cnvrmsy39db6j9sba94y34345kqmg4rc2z150a"))))))) + (define steam-client-libs `(("bash" ,bash) ; Required for steam startup. ("coreutils" ,coreutils) From 6ac2849b56c87c318149d496d0d353ff590a01a9 Mon Sep 17 00:00:00 2001 From: John Kehayias Date: Sun, 22 Oct 2023 15:52:08 -0400 Subject: [PATCH 7/8] [DRAFT] nongnu: steam: Use mesa-next. * nongnu/packages/steam-client.scm (steam-client-libs): Replace mesa-fixed with mesa-next. --- nongnu/packages/steam-client.scm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nongnu/packages/steam-client.scm b/nongnu/packages/steam-client.scm index befcd0b..aa5a8c8 100644 --- a/nongnu/packages/steam-client.scm +++ b/nongnu/packages/steam-client.scm @@ -180,9 +180,7 @@ ("libvdpau-va-gl" ,libvdpau-va-gl) ; Additional VDPAU support. ("llvm" ,llvm-for-mesa) ; Required for mesa. ("lsof" ,lsof) ; Required for some friend's list actions. - ;; TODO: Set back to mesa once libx11 is ungrafted upstream or once - ;; is fixed. - ("mesa" ,mesa-fixed) ; Required for steam startup. + ("mesa" ,mesa-next) ; Required for steam startup. ("nss-certs" ,nss-certs) ; Required for steam login. ("pciutils" ,pciutils) ; Tries to run lspci at steam startup. ("procps" ,procps) From 6da06a35b5b5d7339c5332fbc3652d5a5e656b22 Mon Sep 17 00:00:00 2001 From: John Kehayias Date: Sun, 22 Oct 2023 15:54:54 -0400 Subject: [PATCH 8/8] [WIP] nongnu: multiarch-container: Allow extra shared directories. * nonguix/multiarch-container.scm (make-container-wrapper): Use environment variable $GUIX_SANDBOX_EXTRA_SHARES to pass extra directories to share with the container. --- nonguix/multiarch-container.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nonguix/multiarch-container.scm b/nonguix/multiarch-container.scm index b333b71..e9243f0 100644 --- a/nonguix/multiarch-container.scm +++ b/nonguix/multiarch-container.scm @@ -330,6 +330,9 @@ in a sandboxed FHS environment." ,@(exists-> (getenv "XAUTHORITY")) #$@(ngc-shared container))) (DEBUG (equal? (getenv "DEBUG") "1")) + (extra-shares (if (getenv "GUIX_SANDBOX_EXTRA_SHARES") + (string-split (getenv "GUIX_SANDBOX_EXTRA_SHARES") #\:) + #f)) (args (cdr (command-line))) (command (if DEBUG '() `("--" ,run ,@args)))) @@ -362,7 +365,9 @@ in a sandboxed FHS environment." ,@(map add-path expose) ,@(map (lambda (item) (add-path item #:writable? #t)) - share) + (if extra-shares + (append share extra-shares) + share)) "-m" ,manifest-file ,@command))))))