Subject: fwupd can not find required polkit actions

From: Jelle Licht <[email-masked]>
Date: Wed, 14 Dec 2022 14:06:12 +0100

The package description for fwupd looks for polkit actions in the polkit
output. There are multiple ways to patch this.

--8<---------------cut here---------------start------------->8---
(add-before 'configure 'set-polkit-rules-dir
              ;; Locate actions in our {output,etc-dir}, not that of the polkit input.
              (lambda _
                (setenv "PKG_CONFIG_POLKIT_GOBJECT_1_ACTIONDIR"
                        ;; This makes it 'Just Work':
                        ;; (string-append #$output "/share/polkit-1/actions")
                        ;; This only makes it work when we extend polkit-service-type:
                        (string-append "/etc/polkit-1/actions")
                        )))
--8<---------------cut here---------------end--------------->8---

Example service definition: 
--8<---------------cut here---------------start------------->8---
(define (fwupd-shepherd-service package)
  "Return a Shepherd service to start fwupd."
  (list (shepherd-service
         (requirement '(dbus-system))
         (provision '(fwupd))
         (start #~(make-forkexec-constructor
                   (list #$(file-append package "/libexec/fwupd/fwupd"))))
         (stop #~(make-kill-destructor)))))

(define-public fwupd-service-type
  (service-type
   (name 'fwupd)
   (description "Setup the firmware update deamon.")
   (default-value fwupd)
   (extensions
    (list
     (service-extension profile-service-type list)
     (service-extension polkit-service-type list)
     (service-extension dbus-root-service-type list)
     (service-extension shepherd-root-service-type
                        fwupd-shepherd-service)))))
--8<---------------cut here---------------end--------------->8---

If we go for the first fix, the polkit-service-type extension is not
required. If we go for the /etc fix, the polkit-service-type extension
is required. I know too little about polkit to make an informed choice
here, so with some guidance I could work on a patch to close this issue.

- Jelle