home-services: gnupg: Add gpg-agent-activation service-extension to home-gpg-agent-service

main
Luis Guilherme Coelho 2024-07-31 19:23:51 -03:00
parent bd9ca8936e
commit 812afc56f5
No known key found for this signature in database
GPG Key ID: 1F2E76ACE3F531C8
1 changed files with 13 additions and 0 deletions

View File

@ -20,6 +20,7 @@
(define-module (radix home services gnupg)
#:use-module (guix gexp)
#:use-module (guix modules)
#:use-module ((guix records) #:select (match-record))
#:use-module (gnu services)
#:use-module (gnu services configuration)
@ -154,6 +155,16 @@ agent, with support for handling OpenSSH material."))))
. "$XDG_RUNTIME_DIR/gnupg/S.gpg-agent.ssh"))
'()))))
(define (gpg-agent-activation config)
(with-imported-modules (source-module-closure
'((gnu build activation)))
(match-record config <home-gpg-agent-configuration>
(gnupghome)
#~(begin
(use-modules (gnu build activation))
;; Make sure ~/.gnupg is #o700.
(mkdir-p/perms #$gnupghome (getpw (getuid)) #o700)))))
(define home-gpg-agent-service-type
(service-type
(name 'home-gpg-agent)
@ -162,6 +173,8 @@ agent, with support for handling OpenSSH material."))))
home-gpg-agent-files)
(service-extension home-shepherd-service-type
home-gpg-agent-shepherd-services)
(service-extension home-activation-service-type
gpg-agent-activation)
(service-extension home-environment-variables-service-type
home-gpg-agent-environment-variables)))
(default-value (home-gpg-agent-configuration))