summary refs log tree commit diff
path: root/gnu/services/base.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-04-23 13:33:09 +0200
committerMarius Bakke <mbakke@fastmail.com>2020-04-23 13:33:09 +0200
commit030f6f489fe9544f35ebaf95135acd1dd67ce63f (patch)
treef1d5d1f1b68de81daec6f05d032a0410a475d960 /gnu/services/base.scm
parent95c14929a7fbd3c55c5e8756953c2f257625e2b7 (diff)
parent938df0de739aa13c2fb483f440ec1db281a52aaa (diff)
downloadguix-030f6f489fe9544f35ebaf95135acd1dd67ce63f.tar.gz
Merge branch 'master' into core-updates
 Conflicts:
	etc/news.scm
	gnu/local.mk
	gnu/packages/bootloaders.scm
	gnu/packages/linphone.scm
	gnu/packages/linux.scm
	gnu/packages/tls.scm
	gnu/system.scm
Diffstat (limited to 'gnu/services/base.scm')
-rw-r--r--gnu/services/base.scm24
1 files changed, 23 insertions, 1 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index a532e884c3..3a772d3121 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?
@@ -557,7 +559,7 @@ down.")))
         (documentation "Add TRNG to entropy pool.")
         (requirement '(udev))
         (provision '(trng))
-        (start #~(make-forkexec-constructor #$@rngd-command))
+        (start #~(make-forkexec-constructor '#$rngd-command))
         (stop #~(make-kill-destructor))))))
 
 (define* (rngd-service #:key
@@ -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