Simen Endsjø <cont...@simendsjo.me> writes:

> I'm probably doing something wrong, but I'm having problems using
> `home-gpg-agent-service-type' from a service. It works fine inside an
> `home-environment', but not within a service type.
>
> So this works fine:
> ,----
> | (home-environment
> |   (services
> |    (list
> |     (service home-gpg-agent-service-type
> |              (home-gpg-agent-configuration
> |               (pinentry-program
> |                (file-append sijo-pinentry "/bin/sijo-pinentry"))
> |               (extra-content "allow-loopback-pinentry"))))))
> | 
> `----
>
> But when I move this into a new service, it doesn't seem to do anything,
> and only the default configuration is used.
>
> ,----
> | (home-environment
> |   (services
> |    (list
> |     (service sijo-gpg-service-type))))
> | 
> | (define-public sijo-gpg-service-type
> |   (service-type
> |    (name 'sijo-gpg-service)
> |    (extensions
> |     (list
> |      (service-extension home-profile-service-type
> |                         (lambda (config)
> |                           (list sijo-pinentry)))
> |      ;; This doesn't actually see mto do anything
> |      (service-extension home-gpg-agent-service-type

I do not believe the home-gpg-agent-service-type can be extended.
Looking at the source code:

--8<---------------cut here---------------start------------->8---
(define home-gpg-agent-service-type
  (service-type
   (name 'home-gpg-agent)
   (extensions
    (list (service-extension home-files-service-type
                             home-gpg-agent-files)
          (service-extension home-shepherd-service-type
                             home-gpg-agent-shepherd-services)
          (service-extension home-activation-service-type
                             (const gpg-agent-activation))
          (service-extension home-environment-variables-service-type
                             home-gpg-agent-environment-variables)))
   (default-value (home-gpg-agent-configuration))
   (description
    "Configure GnuPG's agent, @command{gpg-agent}, which is responsible for
managing OpenPGP and optionally SSH private keys.  When SSH support is
enabled, @command{gpg-agent} acts as a drop-in replacement for OpenSSH's
@command{ssh-agent}.")))
--8<---------------cut here---------------end--------------->8---

And the relevant part of the info manual for `Data Type: service-type':

--8<---------------cut here---------------start------------->8---
     ‘extend’ (default: ‘#f’)
          If this is ‘#f’, services of this type cannot be extended.
--8<---------------cut here---------------end--------------->8---

Since the home-gpg-agent-service-type does not set the `extend' field, I
conclude the service cannot be extended.

However the fact that it does not signal an error is (in my opinion) a
bug and you should report it.

> |                         (lambda (config)
> |                           (home-gpg-agent-configuration
> |                            (pinentry-program
> |                             (file-append sijo-pinentry 
> "/bin/sijo-pinentry"))
> |                            (extra-content "allow-loopback-pinentry"))))))
> |    (default-value #f)
> |    (description "")))
> `----
>

Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

Attachment: signature.asc
Description: PGP signature

Reply via email to