ubuntuxp's Blog

ubuntuxp's Avatar Image
Homeschooler that mainly uses :gnu:gnu+linux. Full-time :emacs:emacs user.
← All posts

Recently I wanted to add a custom hwdb file to eudev in Guix System, so I added the following to my system config:
#+begin_src scheme
(define eudev-with-extra-hwdb
(package

(inherit eudev)
(arguments
 (substitute-keyword-arguments (package-arguments eudev)
   ((#:phases phases)
    #~(modify-phases #$phases
        (add-before 'build-hwdb 'copy-additional-hwdb-files
          (lambda* (#:key inputs #:allow-other-keys)
            (copy-file
             ;; find-files returns a list of one, so pick the only item in
             ;; the list.
             (list-ref
              (find-files "/gnu/store"
                          (file-name-predicate
                           ".*99-keyboard-capslock-to-ctrl\\.hwdb"))

              0)
             (string-append #$output "/etc/udev/hwdb.d/"
                            "99-keyboard-capslock-to-ctrl.hwdb"))))))))
(inputs
 (modify-inputs (package-inputs eudev)
   (append
       (plain-file "99-keyboard-capslock-to-ctrl.hwdb"
                   (string-append "evdev:input:*\n"

#+end_src

And in the services field:
#+begin_src scheme
(modify-services %base-services
(udev-service-type config =>

(udev-configuration
  (inherit config)
  (udev eudev-with-extra-hwdb))))

#+end_src

#guix

To like or reply, open original post on Emacs.ch