nonguix: Refactor ld.so.conf creation for nonguix containers.

* nonguix/multiarch-container.scm (packages->ld.so.conf): Delete the function.
(package-directories->ld.so.conf): New function. As TODO statement says, we
are going to accept not the package objects but pure directories, which we can
get via file-append function.
* nongnu/packages/steam-client.scm (%steam-fhs-union-64, %steam-fhs-union-32):
Move definitions to appropriate variables. Use them with file-append function
to provide lib directories for steam-ld.so.conf
* nongnu/packages/steam-client.scm (steam-ld.so.conf): Take advantage of
file-append and specify exact directories we want.
This commit is contained in:
Alexey Abramov 2023-06-07 11:06:04 +02:00
parent 10e3c2bcae
commit 31f2146716
No known key found for this signature in database
GPG Key ID: 352F2B76A8D9E361
2 changed files with 30 additions and 36 deletions

View File

@ -234,19 +234,29 @@ implementation with gogdl and Amazon Games using Nile.")
("which" ,which) ; Heroic complains about trying to use which (though works).
("gtk+" ,gtk+))) ; Required for Heroic interface (gtk filechooser schema).
(define %steam-fhs-union-64
(fhs-union `(,@steam-client-libs
,@steam-gameruntime-libs
,@fhs-min-libs)
#:name "fhs-union-64"))
(define %steam-fhs-union-32
(fhs-union `(,@steam-client-libs
,@steam-gameruntime-libs
,@fhs-min-libs)
#:name "fhs-union-32"
#:system "i686-linux"))
(define steam-ld.so.conf
(packages->ld.so.conf
(list (fhs-union steam-container-libs
#:name "fhs-union-64")
(fhs-union steam-container-libs
#:name "fhs-union-32"
#:system "i686-linux"))))
(package-directories->ld.so.conf
#~(#$(file-append %steam-fhs-union-64 "/lib")
#$(file-append %steam-fhs-union-32 "/lib"))))
(define steam-ld.so.cache
(ld.so.conf->ld.so.cache steam-ld.so.conf))
(define steam-nvidia-ld.so.conf
(packages->ld.so.conf
(package-directories->ld.so.conf
(list (fhs-union steam-nvidia-container-libs
#:name "fhs-union-64")
(fhs-union steam-nvidia-container-libs
@ -263,13 +273,8 @@ implementation with gogdl and Amazon Games using Nile.")
(run "/bin/steam")
(ld.so.conf steam-ld.so.conf)
(ld.so.cache steam-ld.so.cache)
(union64
(fhs-union steam-container-libs
#:name "fhs-union-64"))
(union32
(fhs-union steam-container-libs
#:name "fhs-union-32"
#:system "i686-linux"))
(union64 %steam-fhs-union-64)
(union32 %steam-fhs-union-32)
(link-files '("share"))
(description "Steam is a digital software distribution platform created by
Valve. This package provides a script for launching Steam in a Guix container

View File

@ -77,7 +77,7 @@
fhs-min-libs
fhs-union
ld.so.conf->ld.so.cache
packages->ld.so.conf
package-directories->ld.so.conf
nonguix-container->package))
(define-record-type* <nonguix-container>
@ -150,30 +150,19 @@
"-f" #$ld-conf ; Use #$ld-conf as configuration file.
"-C" #$output)))))) ; Use #$output as cache file.
(define (packages->ld.so.conf packages)
"Takes a list of package objects and returns a file-like object for ld.so.conf
in the Guix store"
(define (package-directories->ld.so.conf directories)
"Takes a list of directories and returns a file-like object containing
a ld.so.conf file with all directories in it."
(computed-file
"ld.so.conf"
#~(begin
;; Need to quote "#$packages" as #$packages tries to "apply" the first item to the rest, like a procedure.
(let* ((packages '#$packages)
;; Add "/lib" to each package.
;; TODO Make this more general for other needed directories.
(dirs-lib
(lambda (packages)
(map (lambda (package)
(string-append package "/lib"))
packages)))
(fhs-lib-dirs
(dirs-lib packages)))
(call-with-output-file #$output
(lambda (port)
(for-each (lambda (directory)
(display directory port)
(newline port))
fhs-lib-dirs)))
#$output))))
(with-output-to-file #$output
(lambda ()
(for-each (lambda (dir)
(display dir)
(newline))
'#$directories))))))
(define (nonguix-container->package container)
"Return a package with wrapper script to launch the supplied container object