diff --git a/radix/home/services/gnupg.scm b/radix/home/services/gnupg.scm index 70c14a5..10dc14b 100644 --- a/radix/home/services/gnupg.scm +++ b/radix/home/services/gnupg.scm @@ -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 + (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))