nonguix: multiarch-container: Allow extra shared directories.

Basic fix for #237.

This allows exposing other directories or drives to the nonguix container, for
example to add additional library locations to Steam, by setting
$GUIX_SANDBOX_EXTRA_SHARES.

* nonguix/multiarch-container.scm (make-container-wrapper): Use environment
variable $GUIX_SANDBOX_EXTRA_SHARES to pass extra directories to share with
the container.
This commit is contained in:
John Kehayias 2023-10-22 15:54:54 -04:00
parent 9a502ae1b0
commit 8078757b88
No known key found for this signature in database
GPG key ID: 499097AE5EA815D9

View file

@ -335,6 +335,9 @@ in a sandboxed FHS environment."
,@(exists-> (getenv "XAUTHORITY")) ,@(exists-> (getenv "XAUTHORITY"))
#$@(ngc-shared container))) #$@(ngc-shared container)))
(DEBUG (equal? (getenv "DEBUG") "1")) (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))) (args (cdr (command-line)))
(command (if DEBUG '() (command (if DEBUG '()
`("--" ,run ,@args)))) `("--" ,run ,@args))))
@ -363,7 +366,9 @@ in a sandboxed FHS environment."
,@(map add-path expose) ,@(map add-path expose)
,@(map (lambda (item) ,@(map (lambda (item)
(add-path item #:writable? #t)) (add-path item #:writable? #t))
share) (if extra-shares
(append share extra-shares)
share))
"-m" ,manifest-file "-m" ,manifest-file
,@command))))))) ,@command)))))))