services: admin: Add a generate-documentation procedure

pull/1/head
Luis Guilherme Coelho 2023-12-24 06:02:35 -03:00
parent dc562d7a2d
commit 4dbfc6d3f6
No known key found for this signature in database
GPG Key ID: 1F2E76ACE3F531C8
1 changed files with 14 additions and 10 deletions

View File

@ -81,18 +81,17 @@ match those specified. The keyword args alone means that command must be run
without arguments.")
(setenv
maybe-assoc-list
"Keep or set the specified variables. Variables may also be removed by
setting them to #f. If the first character of the value is $ then the value
to be set is taken from the existing environment variable with the given name.
This options is processed after the default environment variable has been
created."))
"Set the specified variables. Variables may also be removed by setting them
to #f, or simply exported, by setting them to #t. If the first character of the
value is $ then the value to be set is taken from the existing environment
variable with the given name."))
(define-syntax-rule (permit entry ...)
(permit-statement entry ...))
(define (unset? val)
"Tests if VAL is unset."
(equal? val (@@ (gnu services configuration)
%unset-value)))
%unset-value)))
(define* (if-set val #:optional (proc identity))
"Apply PROC to VAL if VAL is not unset, otherwise returns #f."
@ -152,10 +151,11 @@ without arguments."))
(define (doas-config-file config)
(plain-file "doas.conf"
(apply string-append
(map (lambda (s) (cond ((permit-statement? s)
(serialize-permit-statement s))
((deny-statement? s)
(serialize-deny-statement s))))
(map (lambda (s)
(cond ((permit-statement? s)
(serialize-permit-statement s))
((deny-statement? s)
(serialize-deny-statement s))))
config))))
(define (doas-etc-service config)
@ -171,3 +171,7 @@ without arguments."))
(extend append)
(default-value '())
(description "Set /etc/doas.conf")))
(define (generate-documentation)
(configuration->documentation 'permit-statement)
(configuration->documentation 'deny-statement))