me
/
guix
Archived
1
0
Fork 0

home: services: ssh-agent: Handle setting of SSH_AUTH_SOCK.

* gnu/home/services/ssh.scm (home-ssh-agent-environment-variables): New
procedure.
(home-ssh-agent-service-type): Use it as ahome-environment-service type
extension.
* doc/guix.texi (Secure Shell): Remove advice about, and examples of setting
SSH_AUTH_SOCK.
master
Jan (janneke) Nieuwenhuizen 2023-03-17 12:40:16 +01:00 committed by Janneke Nieuwenhuizen
parent 65f5398dfb
commit 2714c9ef2d
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
2 changed files with 7 additions and 18 deletions

View File

@ -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 @code{(gnu home services ssh-agent)} service, you can configure the
OpenSSH ssh-agent to run upon login. 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 Here is an example of a service and its configuration that you could add
to the @code{services} field of your @code{home-environment}: to the @code{services} field of your @code{home-environment}:

View File

@ -295,12 +295,18 @@ client,@command{ssh}, and by other tools such as @command{guix deploy}.")
(fork+exec-command #$command #:log-file #$log-file))) (fork+exec-command #$command #:log-file #$log-file)))
(stop #~(make-kill-destructor))))))) (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 (define home-ssh-agent-service-type
(service-type (service-type
(name 'home-ssh-agent) (name 'home-ssh-agent)
(default-value (home-ssh-agent-configuration)) (default-value (home-ssh-agent-configuration))
(extensions (extensions
(list (service-extension home-shepherd-service-type (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 (description
"Install and configure @command{ssh-agent} as a Shepherd service."))) "Install and configure @command{ssh-agent} as a Shepherd service.")))