services: 'service-parameters' becomes 'service-value'.
* gnu/services.scm (<service>)[parameters]: Rename to... [value]: ... this. Change calls to 'service-parameters' to 'service-value'. * gnu/system.scm, gnu/tests/base.scm, guix/scripts/system.scm, tests/services.scm: Likewise. * doc/guix.texi (Service Reference): Adjust accordingly.
This commit is contained in:
parent
af3f64477c
commit
efe7d19a9e
|
@ -15684,7 +15684,7 @@ Return true if @var{obj} is a service.
|
||||||
Return the type of @var{service}---i.e., a @code{<service-type>} object.
|
Return the type of @var{service}---i.e., a @code{<service-type>} object.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} service-parameters @var{service}
|
@deffn {Scheme Procedure} service-value @var{service}
|
||||||
Return the value associated with @var{service}. It represents its
|
Return the value associated with @var{service}. It represents its
|
||||||
parameters.
|
parameters.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
|
@ -51,7 +51,8 @@
|
||||||
service
|
service
|
||||||
service?
|
service?
|
||||||
service-kind
|
service-kind
|
||||||
service-parameters
|
service-value
|
||||||
|
service-parameters ;deprecated
|
||||||
|
|
||||||
simple-service
|
simple-service
|
||||||
modify-services
|
modify-services
|
||||||
|
@ -142,10 +143,14 @@
|
||||||
|
|
||||||
;; Services of a given type.
|
;; Services of a given type.
|
||||||
(define-record-type <service>
|
(define-record-type <service>
|
||||||
(service type parameters)
|
(service type value)
|
||||||
service?
|
service?
|
||||||
(type service-kind)
|
(type service-kind)
|
||||||
(parameters service-parameters))
|
(value service-value))
|
||||||
|
|
||||||
|
(define service-parameters
|
||||||
|
;; Deprecated alias.
|
||||||
|
service-value)
|
||||||
|
|
||||||
(define (simple-service name target value)
|
(define (simple-service name target value)
|
||||||
"Return a service that extends TARGET with VALUE. This works by creating a
|
"Return a service that extends TARGET with VALUE. This works by creating a
|
||||||
|
@ -161,7 +166,7 @@ singleton service type NAME, of which the returned service is an instance."
|
||||||
service)
|
service)
|
||||||
((_ svc (kind param => exp ...) clauses ...)
|
((_ svc (kind param => exp ...) clauses ...)
|
||||||
(if (eq? (service-kind svc) kind)
|
(if (eq? (service-kind svc) kind)
|
||||||
(let ((param (service-parameters svc)))
|
(let ((param (service-value svc)))
|
||||||
(service (service-kind svc)
|
(service (service-kind svc)
|
||||||
(begin exp ...)))
|
(begin exp ...)))
|
||||||
(%modify-service svc clauses ...)))))
|
(%modify-service svc clauses ...)))))
|
||||||
|
@ -321,7 +326,7 @@ file."
|
||||||
(define* (activation-service->script service)
|
(define* (activation-service->script service)
|
||||||
"Return as a monadic value the activation script for SERVICE, a service of
|
"Return as a monadic value the activation script for SERVICE, a service of
|
||||||
ACTIVATION-SCRIPT-TYPE."
|
ACTIVATION-SCRIPT-TYPE."
|
||||||
(activation-script (service-parameters service)))
|
(activation-script (service-value service)))
|
||||||
|
|
||||||
(define (activation-script gexps)
|
(define (activation-script gexps)
|
||||||
"Return the system's activation script, which evaluates GEXPS."
|
"Return the system's activation script, which evaluates GEXPS."
|
||||||
|
@ -432,7 +437,7 @@ and FILE could be \"/usr/bin/env\"."
|
||||||
|
|
||||||
(define (etc-directory service)
|
(define (etc-directory service)
|
||||||
"Return the directory for SERVICE, a service of type ETC-SERVICE-TYPE."
|
"Return the directory for SERVICE, a service of type ETC-SERVICE-TYPE."
|
||||||
(files->etc-directory (service-parameters service)))
|
(files->etc-directory (service-value service)))
|
||||||
|
|
||||||
(define (files->etc-directory files)
|
(define (files->etc-directory files)
|
||||||
(file-union "etc" files))
|
(file-union "etc" files))
|
||||||
|
@ -605,7 +610,7 @@ TARGET-TYPE; return the root service adjusted accordingly."
|
||||||
(match (find (matching-extension target)
|
(match (find (matching-extension target)
|
||||||
(service-type-extensions (service-kind service)))
|
(service-type-extensions (service-kind service)))
|
||||||
(($ <service-extension> _ compute)
|
(($ <service-extension> _ compute)
|
||||||
(compute (service-parameters service))))))
|
(compute (service-value service))))))
|
||||||
|
|
||||||
(match (filter (lambda (service)
|
(match (filter (lambda (service)
|
||||||
(eq? (service-kind service) target-type))
|
(eq? (service-kind service) target-type))
|
||||||
|
@ -616,7 +621,7 @@ TARGET-TYPE; return the root service adjusted accordingly."
|
||||||
(extensions (map (apply-extension sink) dependents))
|
(extensions (map (apply-extension sink) dependents))
|
||||||
(extend (service-type-extend (service-kind sink)))
|
(extend (service-type-extend (service-kind sink)))
|
||||||
(compose (service-type-compose (service-kind sink)))
|
(compose (service-type-compose (service-kind sink)))
|
||||||
(params (service-parameters sink)))
|
(params (service-value sink)))
|
||||||
;; We distinguish COMPOSE and EXTEND because PARAMS typically has a
|
;; We distinguish COMPOSE and EXTEND because PARAMS typically has a
|
||||||
;; different type than the elements of EXTENSIONS.
|
;; different type than the elements of EXTENSIONS.
|
||||||
(if extend
|
(if extend
|
||||||
|
|
|
@ -615,7 +615,7 @@ hardware-related operations as necessary when booting a Linux container."
|
||||||
(let* ((services (operating-system-services os #:container? container?))
|
(let* ((services (operating-system-services os #:container? container?))
|
||||||
(boot (fold-services services #:target-type boot-service-type)))
|
(boot (fold-services services #:target-type boot-service-type)))
|
||||||
;; BOOT is the script as a monadic value.
|
;; BOOT is the script as a monadic value.
|
||||||
(service-parameters boot)))
|
(service-value boot)))
|
||||||
|
|
||||||
(define (operating-system-user-accounts os)
|
(define (operating-system-user-accounts os)
|
||||||
"Return the list of user accounts of OS."
|
"Return the list of user accounts of OS."
|
||||||
|
@ -623,12 +623,12 @@ hardware-related operations as necessary when booting a Linux container."
|
||||||
(account (fold-services services
|
(account (fold-services services
|
||||||
#:target-type account-service-type)))
|
#:target-type account-service-type)))
|
||||||
(filter user-account?
|
(filter user-account?
|
||||||
(service-parameters account))))
|
(service-value account))))
|
||||||
|
|
||||||
(define (operating-system-shepherd-service-names os)
|
(define (operating-system-shepherd-service-names os)
|
||||||
"Return the list of Shepherd service names for OS."
|
"Return the list of Shepherd service names for OS."
|
||||||
(append-map shepherd-service-provision
|
(append-map shepherd-service-provision
|
||||||
(service-parameters
|
(service-value
|
||||||
(fold-services (operating-system-services os)
|
(fold-services (operating-system-services os)
|
||||||
#:target-type
|
#:target-type
|
||||||
shepherd-root-service-type))))
|
shepherd-root-service-type))))
|
||||||
|
@ -638,7 +638,7 @@ hardware-related operations as necessary when booting a Linux container."
|
||||||
(let* ((services (operating-system-services os #:container? container?))
|
(let* ((services (operating-system-services os #:container? container?))
|
||||||
(system (fold-services services)))
|
(system (fold-services services)))
|
||||||
;; SYSTEM contains the derivation as a monadic value.
|
;; SYSTEM contains the derivation as a monadic value.
|
||||||
(service-parameters system)))
|
(service-value system)))
|
||||||
|
|
||||||
(define* (operating-system-profile os #:key container?)
|
(define* (operating-system-profile os #:key container?)
|
||||||
"Return a derivation that builds the system profile of OS."
|
"Return a derivation that builds the system profile of OS."
|
||||||
|
|
|
@ -56,7 +56,7 @@ passed a gexp denoting the marionette, and it must return gexp that is
|
||||||
inserted before the first test. This is used to introduce an extra
|
inserted before the first test. This is used to introduce an extra
|
||||||
initialization step, such as entering a LUKS passphrase."
|
initialization step, such as entering a LUKS passphrase."
|
||||||
(define special-files
|
(define special-files
|
||||||
(service-parameters
|
(service-value
|
||||||
(fold-services (operating-system-services os)
|
(fold-services (operating-system-services os)
|
||||||
#:target-type special-files-service-type)))
|
#:target-type special-files-service-type)))
|
||||||
|
|
||||||
|
|
|
@ -289,7 +289,7 @@ This is currently very conservative in that it does not stop or unload any
|
||||||
running service. Unloading or stopping the wrong service ('udev', say) could
|
running service. Unloading or stopping the wrong service ('udev', say) could
|
||||||
bring the system down."
|
bring the system down."
|
||||||
(define new-services
|
(define new-services
|
||||||
(service-parameters
|
(service-value
|
||||||
(fold-services (operating-system-services os)
|
(fold-services (operating-system-services os)
|
||||||
#:target-type shepherd-root-service-type)))
|
#:target-type shepherd-root-service-type)))
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ open connection to the store."
|
||||||
(define (service-node-label service)
|
(define (service-node-label service)
|
||||||
"Return a label to represent SERVICE."
|
"Return a label to represent SERVICE."
|
||||||
(let ((type (service-kind service))
|
(let ((type (service-kind service))
|
||||||
(value (service-parameters service)))
|
(value (service-value service)))
|
||||||
(string-append (symbol->string (service-type-name type))
|
(string-append (symbol->string (service-type-name type))
|
||||||
(cond ((or (number? value) (symbol? value))
|
(cond ((or (number? value) (symbol? value))
|
||||||
(string-append " " (object->string value)))
|
(string-append " " (object->string value)))
|
||||||
|
@ -711,7 +711,7 @@ output when building a system derivation, such as a disk image."
|
||||||
(let* ((services (operating-system-services os))
|
(let* ((services (operating-system-services os))
|
||||||
(pid1 (fold-services services
|
(pid1 (fold-services services
|
||||||
#:target-type shepherd-root-service-type))
|
#:target-type shepherd-root-service-type))
|
||||||
(shepherds (service-parameters pid1)) ;list of <shepherd-service>
|
(shepherds (service-value pid1)) ;list of <shepherd-service>
|
||||||
(sinks (filter (lambda (service)
|
(sinks (filter (lambda (service)
|
||||||
(null? (shepherd-service-requirement service)))
|
(null? (shepherd-service-requirement service)))
|
||||||
shepherds)))
|
shepherds)))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -75,7 +75,7 @@
|
||||||
(iota 5 1)))
|
(iota 5 1)))
|
||||||
#:target-type t1)))
|
#:target-type t1)))
|
||||||
(and (eq? (service-kind r) t1)
|
(and (eq? (service-kind r) t1)
|
||||||
(service-parameters r))))
|
(service-value r))))
|
||||||
|
|
||||||
(test-assert "fold-services, ambiguity"
|
(test-assert "fold-services, ambiguity"
|
||||||
(let* ((t1 (service-type (name 't1) (extensions '())
|
(let* ((t1 (service-type (name 't1) (extensions '())
|
||||||
|
|
Loading…
Reference in New Issue