diff options
author | Brice Waegeneire <brice@waegenei.re> | 2020-04-05 21:51:41 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-04-22 19:23:58 +0200 |
commit | 2b0c0d9301aa70ce57055073a813a3a02c4f1eed (patch) | |
tree | dbfe994e96ed13149bbd84e02ac55fcb750e2102 /gnu/services/base.scm | |
parent | 6ca2d7dae09953fcff59e6332f131c3a40eb05bf (diff) | |
download | guix-2b0c0d9301aa70ce57055073a813a3a02c4f1eed.tar.gz |
services: Add udev-rules-service helper.
* doc/guix.texi (Base services): Add documentation for 'udev-rules-service'. Replace examples of 'udev-service-type' extension with 'udev-rules-service'. * gnu/services/base.scm (udev-rules-service): New procedure. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/services/base.scm')
-rw-r--r-- | gnu/services/base.scm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm index d7f3c30b7b..2913478e4a 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -12,6 +12,7 @@ ;;; Copyright © 2019 John Soo <jsoo1@asu.edu> ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de> +;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> ;;; ;;; This file is part of GNU Guix. ;;; @@ -92,6 +93,7 @@ udev-service udev-rule file->udev-rule + udev-rules-service login-configuration login-configuration? @@ -2042,6 +2044,26 @@ extra rules from the packages listed in @var{rules}." (service udev-service-type (udev-configuration (udev udev) (rules rules)))) +(define* (udev-rules-service name rules #:key (groups '())) + "Return a service that extends udev-service-type with RULES and +account-service-type with GROUPS as system groups. This works by creating a +singleton service type NAME-udev-rules, of which the returned service is an +instance." + (let* ((name (symbol-append name '-udev-rules)) + (account-extension + (const (map (lambda (group) + (user-group (name group) (system? #t))) + groups))) + (udev-extension (const (list rules))) + (type (service-type + (name name) + (extensions (list + (service-extension + account-service-type account-extension) + (service-extension + udev-service-type udev-extension)))))) + (service type #f))) + (define swap-service-type (shepherd-service-type 'swap |