From 812afc56f582373c823870e5f685b99dfc95eef0 Mon Sep 17 00:00:00 2001 From: Luis Guilherme Coelho Date: Wed, 31 Jul 2024 19:23:51 -0300 Subject: [PATCH] home-services: gnupg: Add gpg-agent-activation service-extension to home-gpg-agent-service --- radix/home/services/gnupg.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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))