services: wesnothd: Use 'least-authority-wrapper'.

* gnu/services/games.scm (wesnothd-shepherd-service): Use
'least-authority-wrapper' instead of
'make-forkexec-constructor/container'.
This commit is contained in:
Ludovic Courtès 2022-04-17 15:32:19 +02:00
parent 19df5f2423
commit 53dbc6fd9a
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5

@ -23,6 +23,9 @@
#:use-module (gnu packages admin) #:use-module (gnu packages admin)
#:use-module (gnu packages games) #:use-module (gnu packages games)
#:use-module (gnu system shadow) #:use-module (gnu system shadow)
#:use-module ((gnu system file-systems) #:select (file-system-mapping))
#:use-module (gnu build linux-container)
#:autoload (guix least-authority) (least-authority-wrapper)
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module (guix modules) #:use-module (guix modules)
#:use-module (guix records) #:use-module (guix records)
@ -57,22 +60,20 @@
(define wesnothd-shepherd-service (define wesnothd-shepherd-service
(match-lambda (match-lambda
(($ <wesnothd-configuration> package port) (($ <wesnothd-configuration> package port)
(with-imported-modules (source-module-closure (let ((wesnothd (least-authority-wrapper
'((gnu build shepherd) (file-append package "/bin/wesnothd")
(gnu system file-systems))) #:name "wesnothd"
#:mappings (list (file-system-mapping
(source "/var/run/wesnothd")
(target source)
(writable? #t)))
#:namespaces (delq 'net %namespaces))))
(shepherd-service (shepherd-service
(documentation "The Battle for Wesnoth server") (documentation "The Battle for Wesnoth server")
(provision '(wesnoth-daemon)) (provision '(wesnoth-daemon))
(requirement '(networking)) (requirement '(networking))
(modules '((gnu build shepherd) (start #~(make-forkexec-constructor
(gnu system file-systems))) (list #$wesnothd "-p" #$(number->string port))
(start #~(make-forkexec-constructor/container
(list #$(file-append package "/bin/wesnothd")
"-p" #$(number->string port))
#:mappings (list (file-system-mapping
(source "/var/run/wesnothd")
(target source)
(writable? #t)))
#:user "wesnothd" #:group "wesnothd")) #:user "wesnothd" #:group "wesnothd"))
(stop #~(make-kill-destructor))))))) (stop #~(make-kill-destructor)))))))