gnu: Add umu-launcher and umu-launcher-run.

* nongnu/packages/game-client.scm (umu-launcher, umu-launcher-container,
umu-launcher-run): New variable.
This commit is contained in:
John Kehayias 2025-01-20 21:09:27 -05:00
parent dfeebe2ae8
commit 99eff92b50
No known key found for this signature in database
GPG Key ID: 499097AE5EA815D9

View File

@ -16,6 +16,7 @@
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (guix build-system pyproject)
#:use-module (guix build-system python)
@ -43,10 +44,12 @@
#:use-module (gnu packages llvm)
#:use-module (gnu packages logging)
#:use-module (gnu packages lsof)
#:use-module (gnu packages man)
#:use-module (nongnu packages nvidia)
#:use-module (gnu packages pciutils)
#:use-module (gnu packages pulseaudio)
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
#:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages toolkits)
@ -319,6 +322,115 @@ all the dependencies incincluded in the container for Steam.")))
(define-public run-in-game-client-container (nonguix-container->package run-in-gc-container))
(define-public umu-launcher
(package
(name "umu-launcher")
(version "1.1.4")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/Open-Wine-Components/umu-launcher")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32 "1vha229dkdr8gbgh8md5k6nsa07hxi13mmdw13xw0mrnm8mibssc"))))
(build-system gnu-build-system)
(arguments
(list #:tests? #f ;no tests
#:make-flags
#~(list (string-append "PYTHON_INTERPRETER="
#$(this-package-input "python")
"/bin/python3")
(string-append "DESTDIR=" #$output))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'fix-path
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "Makefile.in"
(("\\$\\(PYTHONDIR\\)/umu/umu_run.py")
(string-append #$output "/lib/python"
#$(version-major+minor
(package-version (this-package-input "python")))
"/site-packages/umu/umu_run.py")))))
(replace 'configure
(lambda _
;; Build complains about no zip before 1980 stamps (even if
;; importing and using the ensure-no-mtimes-pre-1980
;; phase).
(setenv "SOURCE_DATE_EPOCH" "1531865062")
(invoke "sh" "configure.sh" (string-append "--prefix=" #$output))))
;; Like the Nix packaging done upstream, need to unnest the
;; "install."
(add-after 'install 'fix-install
(lambda _
(let ((output-output (string-append #$output "/" #$output))
(output-python (string-append #$output "/"
#$(this-package-input "python"))))
(copy-recursively output-output #$output)
(delete-file-recursively output-output)
(copy-recursively output-python #$output)
(delete-file-recursively output-python))))
(add-after 'fix-install 'python-wrap
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((python-path (string-append
"/lib/python"
#$(version-major+minor
(package-version (this-package-input "python")))
"/site-packages")))
(for-each (lambda (prog)
(wrap-program (string-append #$output prog)
`("GUIX_PYTHONPATH" =
(,(string-append (getenv "GUIX_PYTHONPATH")
":" #$output python-path)))))
(list "/bin/umu-run"
(string-append "/share/steam/compatibilitytools.d/"
"umu-launcher/umu-run")))))))))
(inputs (list bash-minimal python python-filelock python-xlib))
(native-inputs (list python-pypa-build
python-pypa-installer
python-hatchling
scdoc))
(home-page "https://github.com/Open-Wine-Components/umu-launcher")
(synopsis "Unified launcher for Windows games")
(description "umu-launcher is a unified launcher for Windows games on Linux. It is
essentially a copy of the Steam Runtime Tools and Steam Linux Runtime that
Valve uses for Proton, with some modifications made so that it can be used
outside of Steam.
You probably want the umu-launcher-run package to use umu-launcher, as that
will run in the nonguix container (like for Steam and Heroic).")
(license license:gpl3)))
(define-public umu-launcher-container
(nonguix-container
(name "umu-launcher-run")
(wrap-package umu-launcher)
(run "/bin/umu-run")
(ld.so.conf steam-ld.so.conf)
(ld.so.cache steam-ld.so.cache)
(union64
(fhs-union `(,@heroic-extra-client-libs
,@steam-container-libs)
#:name "fhs-union-64"))
(union32
(fhs-union steam-container-libs
#:name "fhs-union-32"
#:system "i686-linux"))
(link-files '("share"))
(preserved-env '("^GAMEID"))
(description "Use this package for the command umu-launcher-run, which
runs umu-run in the nonguix container environment. For example, to run a game
installed by legendary,
@example
GAMEID=umu-<game> GUIX_SANDBOX_EXTRA_SHARES=/home/<user>/Games guix shell \\
legendary umu-launcher-run -- \\
legendary launch <game> --no-wine --wrapper umu-launcher-run
@end example")))
(define-public umu-launcher-run (nonguix-container->package umu-launcher-container))
(define-public heroic-container
(nonguix-container
(name "heroic")