services: udev: Rewrite udev-rule to use file->udev-rule.

* gnu/services/base.scm (udev-rule): Use file->udev-rule.
This commit is contained in:
Vivien Kraus 2023-10-05 19:33:24 +02:00 committed by Liliana Marie Prikler
parent cde1becfab
commit c2c29eb1b4
No known key found for this signature in database
GPG key ID: 442A84B8C70E2F87

View file

@ -2262,19 +2262,7 @@ (define (rules-sub-directory directory)
(define (udev-rule file-name contents)
"Return a directory with a udev rule file FILE-NAME containing CONTENTS."
(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"))
(mkdir-p rules.d)
(call-with-output-file
(string-append rules.d "/" #$file-name)
(lambda (port)
(display #$contents port)))))))
(file->udev-rule file-name (plain-file file-name contents)))
(define (file->udev-rule file-name file)
"Return a directory with a udev rule file FILE-NAME which is a copy of FILE."