mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-18 21:46:35 +01:00
services: <shepherd-service> no longer has an 'imported-modules' field.
* gnu/services/shepherd.scm (<shepherd-service>)[imported-modules]: Remove. (%default-imported-modules): Make private. (shepherd-service-file): Use 'with-imported-modules'. (shepherd-configuration-file): Remove 'modules' and the calls to 'imported-modules' and 'compiled-modules'. Use 'with-imported-modules' instead. * doc/guix.texi (Shepherd Services): Adjust accordingly. * gnu/services/base.scm (file-system-shepherd-service): Use 'with-imported-modules'. Remove 'imported-modules' field. * gnu/system/mapped-devices.scm (device-mapping-service-type): Remove 'imported-modules'. (open-luks-device): Use 'with-imported-modules'. * gnu/tests.scm (marionette-shepherd-service): Remove 'imported-modules' field and use 'with-imported-modules'.
This commit is contained in:
parent
fd12989398
commit
a91c3fc727
5 changed files with 131 additions and 151 deletions
|
@ -10848,10 +10848,6 @@ where @var{service-name} is one of the symbols in @var{provision}
|
|||
This is the list of modules that must be in scope when @code{start} and
|
||||
@code{stop} are evaluated.
|
||||
|
||||
@item @code{imported-modules} (default: @var{%default-imported-modules})
|
||||
This is the list of modules to import in the execution environment of
|
||||
the Shepherd.
|
||||
|
||||
@end table
|
||||
@end deftp
|
||||
|
||||
|
|
|
@ -229,6 +229,8 @@ (define (file-system-shepherd-service file-system)
|
|||
(create? (file-system-create-mount-point? file-system))
|
||||
(dependencies (file-system-dependencies file-system)))
|
||||
(if (file-system-mount? file-system)
|
||||
(with-imported-modules '((gnu build file-systems)
|
||||
(guix build bournish))
|
||||
(list
|
||||
(shepherd-service
|
||||
(provision (list (file-system->shepherd-service-name file-system)))
|
||||
|
@ -278,10 +280,7 @@ (define (file-system-shepherd-service file-system)
|
|||
;; We need an additional module.
|
||||
(modules `(((gnu build file-systems)
|
||||
#:select (check-file-system canonicalize-device-spec))
|
||||
,@%default-modules))
|
||||
(imported-modules `((gnu build file-systems)
|
||||
(guix build bournish)
|
||||
,@%default-imported-modules))))
|
||||
,@%default-modules)))))
|
||||
'())))
|
||||
|
||||
(define file-system-service-type
|
||||
|
|
|
@ -47,9 +47,7 @@ (define-module (gnu services shepherd)
|
|||
shepherd-service-stop
|
||||
shepherd-service-auto-start?
|
||||
shepherd-service-modules
|
||||
shepherd-service-imported-modules
|
||||
|
||||
%default-imported-modules
|
||||
%default-modules
|
||||
|
||||
shepherd-service-file
|
||||
|
@ -138,9 +136,7 @@ (define-record-type* <shepherd-service>
|
|||
(auto-start? shepherd-service-auto-start? ;Boolean
|
||||
(default #t))
|
||||
(modules shepherd-service-modules ;list of module names
|
||||
(default %default-modules))
|
||||
(imported-modules shepherd-service-imported-modules ;list of module names
|
||||
(default %default-imported-modules)))
|
||||
(default %default-modules)))
|
||||
|
||||
(define (shepherd-service-canonical-name service)
|
||||
"Return the 'canonical name' of SERVICE."
|
||||
|
@ -203,6 +199,7 @@ (define (shepherd-service-file-name service)
|
|||
(define (shepherd-service-file service)
|
||||
"Return a file defining SERVICE."
|
||||
(gexp->file (shepherd-service-file-name service)
|
||||
(with-imported-modules %default-imported-modules
|
||||
#~(begin
|
||||
(use-modules #$@(shepherd-service-modules service))
|
||||
|
||||
|
@ -212,28 +209,16 @@ (define (shepherd-service-file service)
|
|||
#:requires '#$(shepherd-service-requirement service)
|
||||
#:respawn? '#$(shepherd-service-respawn? service)
|
||||
#:start #$(shepherd-service-start service)
|
||||
#:stop #$(shepherd-service-stop service)))))
|
||||
#:stop #$(shepherd-service-stop service))))))
|
||||
|
||||
(define (shepherd-configuration-file services)
|
||||
"Return the shepherd configuration file for SERVICES."
|
||||
(define modules
|
||||
(delete-duplicates
|
||||
(append-map shepherd-service-imported-modules services)))
|
||||
|
||||
(assert-valid-graph services)
|
||||
|
||||
(mlet %store-monad ((modules (imported-modules modules))
|
||||
(compiled (compiled-modules modules))
|
||||
(files (mapm %store-monad
|
||||
shepherd-service-file
|
||||
services)))
|
||||
(mlet %store-monad ((files (mapm %store-monad
|
||||
shepherd-service-file services)))
|
||||
(define config
|
||||
#~(begin
|
||||
(eval-when (expand load eval)
|
||||
(set! %load-path (cons #$modules %load-path))
|
||||
(set! %load-compiled-path
|
||||
(cons #$compiled %load-compiled-path)))
|
||||
|
||||
(use-modules (srfi srfi-34)
|
||||
(system repl error-handling))
|
||||
|
||||
|
|
|
@ -85,9 +85,7 @@ (define device-mapping-service-type
|
|||
(modules `((rnrs bytevectors) ;bytevector?
|
||||
((gnu build file-systems)
|
||||
#:select (find-partition-by-luks-uuid))
|
||||
,@%default-modules))
|
||||
(imported-modules `((gnu build file-systems)
|
||||
,@%default-imported-modules)))))))
|
||||
,@%default-modules)))))))
|
||||
|
||||
(define (device-mapping-service mapped-device)
|
||||
"Return a service that sets up @var{mapped-device}."
|
||||
|
@ -101,6 +99,8 @@ (define (device-mapping-service mapped-device)
|
|||
(define (open-luks-device source target)
|
||||
"Return a gexp that maps SOURCE to TARGET as a LUKS device, using
|
||||
'cryptsetup'."
|
||||
(with-imported-modules '((gnu build file-systems)
|
||||
(guix build bournish))
|
||||
#~(let ((source #$source))
|
||||
(zero? (system* (string-append #$cryptsetup "/sbin/cryptsetup")
|
||||
"open" "--type" "luks"
|
||||
|
@ -114,7 +114,7 @@ (define (open-luks-device source target)
|
|||
(error "LUKS partition not found" source))
|
||||
source)
|
||||
|
||||
#$target))))
|
||||
#$target)))))
|
||||
|
||||
(define (close-luks-device source target)
|
||||
"Return a gexp that closes TARGET, a LUKS device."
|
||||
|
|
|
@ -80,9 +80,9 @@ (define (marionette-shepherd-service config)
|
|||
(srfi srfi-9 gnu)
|
||||
(guix build syscalls)
|
||||
(rnrs bytevectors)))
|
||||
(imported-modules `((guix build syscalls)
|
||||
,@imported-modules))
|
||||
(start
|
||||
(with-imported-modules `((guix build syscalls)
|
||||
,@imported-modules)
|
||||
#~(lambda ()
|
||||
(define (clear-echo termios)
|
||||
(set-field termios (termios-local-flags)
|
||||
|
@ -141,7 +141,7 @@ (define (self-quoting? x)
|
|||
(lambda ()
|
||||
(primitive-exit 1))))
|
||||
(pid
|
||||
pid))))
|
||||
pid)))))
|
||||
(stop #~(make-kill-destructor)))))))
|
||||
|
||||
(define marionette-service-type
|
||||
|
|
Loading…
Reference in a new issue