diff --git a/doc/guix.texi b/doc/guix.texi index 4807f16c0a..2d42ca8de2 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -42473,23 +42473,6 @@ machines using the @acronym{SSH, secure shell} protocol. With the @code{(gnu home services ssh-agent)} service, you can configure the OpenSSH ssh-agent to run upon login. -When using the @code{home-ssh-agent-service-type}, you need to add your -@file{~/.bash_profile}: - -@example -SSH_AUTH_SOCK=$@{XDG_RUNTIME_DIR-$HOME/.cache@}/ssh-agent/socket -export SSH_AUTH_SOCK -@end example - -Of course, you can do that using the @code{home-bash-service-type}, by -adding something like: - -@lisp -(environment-variables - '(("SSH_AUTH_SOCK" - . "$@{SSH_AUTH_SOCK-$@{XDG_RUNTIME_DIR-$HOME/.cache@}/ssh-agent/socket@}"))) -@end lisp - Here is an example of a service and its configuration that you could add to the @code{services} field of your @code{home-environment}: diff --git a/gnu/home/services/ssh.scm b/gnu/home/services/ssh.scm index dc37ecf329..01917a29cd 100644 --- a/gnu/home/services/ssh.scm +++ b/gnu/home/services/ssh.scm @@ -295,12 +295,18 @@ (define (home-ssh-agent-services config) (fork+exec-command #$command #:log-file #$log-file))) (stop #~(make-kill-destructor))))))) +(define (home-ssh-agent-environment-variables config) + '(("SSH_AUTH_SOCK" + . "${SSH_AUTH_SOCK-${XDG_RUNTIME_DIR-$HOME/.cache}/ssh-agent/socket}"))) + (define home-ssh-agent-service-type (service-type (name 'home-ssh-agent) (default-value (home-ssh-agent-configuration)) (extensions (list (service-extension home-shepherd-service-type - home-ssh-agent-services))) + home-ssh-agent-services) + (service-extension home-environment-variables-service-type + home-ssh-agent-environment-variables))) (description "Install and configure @command{ssh-agent} as a Shepherd service.")))