services: singularity: Migrate to (gnu system privilege).

* gnu/services/docker.scm (singularity-setuid-programs): Rename from this…
(singularity-privileged-programs): …to this.  Use <privileged-program>.
(singularity-service-type): Extend the PRIVILEGED-PROGRAM-SERVICE-TYPE.

Change-Id: I4d90f9a6d4759a24a818baab49b61be67c419bad
This commit is contained in:
Tobias Geerinckx-Rice 2024-09-01 02:00:00 +02:00
parent 76cb23c117
commit 98bc13b9ea
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -31,7 +31,7 @@ (define-module (gnu services docker)
#:use-module (gnu services shepherd)
#:use-module (gnu system)
#:use-module (gnu system image)
#:use-module (gnu system setuid)
#:use-module (gnu system privilege)
#:use-module (gnu system shadow)
#:use-module (gnu packages admin) ;shadow
#:use-module (gnu packages docker)
@ -268,11 +268,11 @@ (define %mount-directory
'("container" "final" "overlay" "session"))
(chmod %mount-directory #o755))))
(define (singularity-setuid-programs singularity)
"Return the setuid-root programs that SINGULARITY needs."
(define (singularity-privileged-programs singularity)
"Return the privileged programs that SINGULARITY needs."
(define helpers
;; The helpers, under a meaningful name.
(computed-file "singularity-setuid-helpers"
(computed-file "singularity-privileged-helpers"
#~(begin
(mkdir #$output)
(for-each (lambda (program)
@ -286,7 +286,8 @@ (define helpers
"-helper")))
'("action" "mount" "start")))))
(map file-like->setuid-program
(map (lambda (program) (privileged-program (program program)
(setuid? #t)))
(list (file-append helpers "/singularity-action-helper")
(file-append helpers "/singularity-mount-helper")
(file-append helpers "/singularity-start-helper"))))
@ -296,8 +297,8 @@ (define singularity-service-type
(description
"Install the Singularity application bundle tool.")
(extensions
(list (service-extension setuid-program-service-type
singularity-setuid-programs)
(list (service-extension privileged-program-service-type
singularity-privileged-programs)
(service-extension activation-service-type
(const %singularity-activation))))
(default-value singularity)))