From 6e644cfdb38b74a83bfc133807b5f503b54e8c73 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Wed, 27 Sep 2017 21:33:25 -0400 Subject: services: base: Add file->udev-rule function. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- gnu/services/base.scm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gnu') 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 @@ (define-module (gnu services base) udev-service-type udev-service udev-rule + file->udev-rule login-configuration login-configuration? @@ -1630,6 +1631,22 @@ (define rules.d (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, -- cgit v1.2.3