unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Extending home-gpg-agent-service-type from a service-type doesn't do anything?
@ 2025-01-08 22:23 Simen Endsjø
  2025-01-11  0:15 ` Tomas Volf
  0 siblings, 1 reply; 2+ messages in thread
From: Simen Endsjø @ 2025-01-08 22:23 UTC (permalink / raw)
  To: help-guix

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Extending home-gpg-agent-service-type from a service-type doesn't do anything?
  2025-01-08 22:23 Extending home-gpg-agent-service-type from a service-type doesn't do anything? Simen Endsjø
@ 2025-01-11  0:15 ` Tomas Volf
  0 siblings, 0 replies; 2+ messages in thread
From: Tomas Volf @ 2025-01-11  0:15 UTC (permalink / raw)
  To: Simen Endsjø; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 3450 bytes --]

Simen Endsjø <contact@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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-11  0:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-08 22:23 Extending home-gpg-agent-service-type from a service-type doesn't do anything? Simen Endsjø
2025-01-11  0:15 ` Tomas Volf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).