Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emacs daemon doesn't see SSH_AUTH_SOCK from gnupg #55733

Closed
shosti opened this issue Feb 13, 2019 · 3 comments · Fixed by #56254
Closed

Emacs daemon doesn't see SSH_AUTH_SOCK from gnupg #55733

shosti opened this issue Feb 13, 2019 · 3 comments · Fixed by #56254

Comments

@shosti
Copy link
Contributor

shosti commented Feb 13, 2019

Issue description

Since #48772, emacs run through services.emacs doesn't see SSH_AUTH_SOCK set by programs.gnupg.agent.enableSSHSupport. This is problematic because packages like magit will not use the correct SSH agent.

SSH_AUTH_SOCK does work correctly in 18.09; this is a regression on master.

Steps to reproduce

  1. Put the following in your config:
programs.gnupg.agent = {
  enable = true;
  enableSSHSupport = true;
}

services.emacs.enable = true;
  1. emacsclient -e '(getenv "SSH_AUTH_SOCK")'

The result will be nil. (Note that if you start emacs from a shell and evaluate the above expression, the result will be correct.)

Technical details

  • system: "x86_64-linux"
  • host os: Linux 4.19.20, NixOS, 19.03pre169108.36f31600749 (Koi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.2
  • channels(root): "nixos-19.03pre169108.36f31600749"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
@FlorianFranzen
Copy link
Contributor

FlorianFranzen commented Feb 14, 2019

Does systemctl --user import-environment SSH_AUTH_SOCK help with the issue? You might have to restart emacs with systemctl --user restart emacs to see the effect.

@shosti
Copy link
Contributor Author

shosti commented Feb 14, 2019

The root cause is clear: the above PR swapped extraInit with interactiveShellInit, which isn’t sourced for systemd daemons. I added the SSH_AUTH_SOCK portion to extraInit in my configuration.nix, which fixes the issue, but it’s pretty clear to me that SSH_AUTH_SOCK should be set in both interactive shells and systemd daemons.

shosti added a commit to shosti/nixpkgs that referenced this issue Feb 23, 2019
`SSH_AUTH_SOCK` is useful in some non-interactive settings, for instance
daemonized Emacs. Fixes NixOS#55733.
@shosti
Copy link
Contributor Author

shosti commented Feb 28, 2019

PR to fix open at #56254, does that seem like a reasonable approach?

infinisil pushed a commit that referenced this issue Apr 12, 2019
`SSH_AUTH_SOCK` is useful in some non-interactive settings, for instance
daemonized Emacs. Fixes #55733.

(cherry picked from commit ddabdc0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants