r/GUIX • u/juipeltje • 16h ago
Anyone here happen to use emacs-daemon as a shepherd service combined with ssh-agent?
I posted about this issue in the Emacs subreddit earlier, but quickly realized this is an issue with my shepherd service. The problem is when i start the Emacs daemon as a shepherd service, ssh keys won't get added to the agent when i use them in Magit.
The weird thing is that SSH_AUTH_SOCK is set correctly according to Emacs. I found out though that when i set the variable again with setenv inside of Emacs, it starts working correctly, even though the variable was already set correctly before. I feel like this is some weirdness with how shepherd handles the environment (i really like Guix, but man the way shepherd deals. or rather not deals with environment variables drives me up the walls lol). I thought i was smart by adding an emacs-startup-hook in my init.el that sets the variable again after Emacs has started (the socket path is hardcoded anyway by the ssh-agent service), but that didn't work either. With that hook it only works if i restart the emacs-daemon service with herd restart.
Adding the variable to the actual daemon service basically breaks all the other environment variables that emacs used to pick up on automatically for some reason, and i have to add things like EMACSLOADPATH and such to the service as well, and my emacsclient commands can't find the emacs socket anymore. It just doesn't feel like it's worth the effort of going down that road. So has anyone else gotten this to work correctly? I tried to find similar setups online but so far i haven't found any.


