aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2017-09-27 21:33:25 -0400
committerLudovic Courtès <ludo@gnu.org>2017-10-22 22:09:00 -0700
commit6e644cfdb38b74a83bfc133807b5f503b54e8c73 (patch)
tree782287d745ff50943596aeadc616a2b053ed8e6e /gnu
parent2f05dd6b4cd84c6f431da94d47668ed0b34a6e1c (diff)
downloadguix-6e644cfdb38b74a83bfc133807b5f503b54e8c73.tar
guix-6e644cfdb38b74a83bfc133807b5f503b54e8c73.tar.gz
services: base: Add file->udev-rule function.
This function allows passing a file-like object to the udev service. * gnu/services/base.scm (file->udev-rule): New function. * doc/guix.texi (Base Services): Document it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/base.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 541ca76f14..b605614ab6 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -71,6 +71,7 @@
udev-service-type
udev-service
udev-rule
+ file->udev-rule
login-configuration
login-configuration?
@@ -1630,6 +1631,22 @@ item of @var{packages}."
(lambda (port)
(display #$contents port)))))))
+(define (file->udev-rule file-name file)
+ "Return a directory with a udev rule file FILE-NAME which is a copy of FILE."
+ (computed-file file-name
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+
+ (define rules.d
+ (string-append #$output "/lib/udev/rules.d"))
+
+ (define file-copy-dest
+ (string-append rules.d "/" #$file-name))
+
+ (mkdir-p rules.d)
+ (copy-file #$file file-copy-dest)))))
+
(define kvm-udev-rule
;; Return a directory with a udev rule that changes the group of /dev/kvm to
;; "kvm" and makes it #o660. Apparently QEMU-KVM used to ship this rule,