aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-12-16 23:52:06 +0100
committerLudovic Courtès <ludo@gnu.org>2018-12-17 23:33:42 +0100
commitbafcf1f32f3dfaf494d7640a3882585c143378cd (patch)
treea2250a09e9ccea080076b44f6781e80cd1a233c7
parentcce654fabdf09cac7d18f9bad842ba8445aa022c (diff)
downloadguix-bafcf1f32f3dfaf494d7640a3882585c143378cd.tar.gz
guix-bafcf1f32f3dfaf494d7640a3882585c143378cd.zip
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'.
-rw-r--r--doc/guix.texi5
-rw-r--r--gnu/services/base.scm10
2 files changed, 13 insertions, 2 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 338ff45c39..1c26dc5a89 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -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}
variable. The procedures @var{udev-rule} and @var{file->udev-rule} from
@code{(gnu services base)} simplify the creation of such rule files.
+@end deffn
@deffn {Scheme Procedure} udev-rule [@var{file-name} @var{contents}]
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\", "
"RUN+=\"/path/to/script\"")))
@end example
+
+The @command{herd rules udev} command, as root, returns the name of the
+directory containing all the active udev rules.
@end deffn
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
(udev-configuration-rules config))))))))
@end example
-@end deffn
@defvr {Scheme Variable} urandom-seed-service-type
Save some entropy in @var{%random-seed-file} to seed @file{/dev/urandom}
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index b10f5cbaf1..67bdaef18c 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1967,7 +1967,15 @@ item of @var{packages}."
(respawn? #f)
;; We need additional modules.
(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
(service-type (name 'udev)