services: udev: Add 'rules' action.

* gnu/services/base.scm (udev-shepherd-service): Add 'actions' field.
* doc/guix.texi (Base Services): Move "@end deffn" after 'udev-service'
definition.  Mention 'herd rules udev'.
This commit is contained in:
Ludovic Courtès 2018-12-16 23:52:06 +01:00
parent cce654fabd
commit bafcf1f32f
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 13 additions and 2 deletions

View File

@ -11308,6 +11308,7 @@ Run @var{udev}, which populates the @file{/dev} directory dynamically.
udev rules can be provided as a list of files through the @var{rules} udev rules can be provided as a list of files through the @var{rules}
variable. The procedures @var{udev-rule} and @var{file->udev-rule} from variable. The procedures @var{udev-rule} and @var{file->udev-rule} from
@code{(gnu services base)} simplify the creation of such rule files. @code{(gnu services base)} simplify the creation of such rule files.
@end deffn
@deffn {Scheme Procedure} udev-rule [@var{file-name} @var{contents}] @deffn {Scheme Procedure} udev-rule [@var{file-name} @var{contents}]
Return a udev-rule file named @var{file-name} containing the rules Return a udev-rule file named @var{file-name} containing the rules
@ -11325,6 +11326,9 @@ upon detecting a USB device with a given product identifier.
"ATTR@{product@}==\"Example\", " "ATTR@{product@}==\"Example\", "
"RUN+=\"/path/to/script\""))) "RUN+=\"/path/to/script\"")))
@end example @end example
The @command{herd rules udev} command, as root, returns the name of the
directory containing all the active udev rules.
@end deffn @end deffn
Here we show how the default @var{udev-service} can be extended with it. Here we show how the default @var{udev-service} can be extended with it.
@ -11406,7 +11410,6 @@ well as in the @var{groups} field of the @var{operating-system} record.
(rules (cons* android-udev-rules (rules (cons* android-udev-rules
(udev-configuration-rules config)))))))) (udev-configuration-rules config))))))))
@end example @end example
@end deffn
@defvr {Scheme Variable} urandom-seed-service-type @defvr {Scheme Variable} urandom-seed-service-type
Save some entropy in @var{%random-seed-file} to seed @file{/dev/urandom} Save some entropy in @var{%random-seed-file} to seed @file{/dev/urandom}

View File

@ -1967,7 +1967,15 @@ item of @var{packages}."
(respawn? #f) (respawn? #f)
;; We need additional modules. ;; We need additional modules.
(modules `((gnu build linux-boot) (modules `((gnu build linux-boot)
,@%default-modules)))))))) ,@%default-modules))
(actions (list (shepherd-action
(name 'rules)
(documentation "Display the directory containing
the udev rules in use.")
(procedure #~(lambda (_)
(display #$rules)
(newline))))))))))))
(define udev-service-type (define udev-service-type
(service-type (name 'udev) (service-type (name 'udev)