guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 02/02: doc: Add an example to the documentation of the udev-service.


From: Ludovic Courtès
Subject: Re: 02/02: doc: Add an example to the documentation of the udev-service.
Date: Fri, 13 Oct 2017 10:35:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Hi!

address@hidden (Ricardo Wurmus) skribis:

> commit e0c1d080b520c1bbd2dcd7bc90a750f5ce580486
> Author: Ricardo Wurmus <address@hidden>
> Date:   Mon Oct 9 23:03:56 2017 +0200
>
>     doc: Add an example to the documentation of the udev-service.
>     
>     * doc/guix.texi (Base Services): Update 'udev-service' documentation.

Good idea.

> address@hidden
> +(define %example-udev-rule
> +  (udev-rule "90-usb-thing.rules"
> +             "ACTION==\"add\", SUBSYSTEM==\"usb\", 
> address@hidden@}==\"Example\", RUN+=\"/path/to/script\""))
> +
> +(operating-system
> +  ;; @dots{}
> +  (services (modify-services %desktop-services
> +              (udev-service-type config =>
> +                (udev-configuration (inherit config)
> +                  (rules (append (udev-configuration-rules config)
> +                                 (list %example-udev-rule))))))))
> address@hidden example

<https://bugs.gnu.org/28647> is somewhat related.

Fundamentally though, to simplify this use case, we should have:

  (define (additional-udev-rules . rules)
    "Add RULES, a list of file-like object, as a udev rules."
    (simple-service 'udev-rule udev-service-type rules))

so one can write:

  (operating-system
     ;; …
     (services (cons (additional-udev-rules %example-udev-rule)
                     %desktop-services)))

Thoughts?

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]