Home-Manager SSH-Agent fails to set Environment Variables

Hi everybody,

In my Flake-Config with Home-Manager on nixpkgs Unstable, my Home-Manager fails to set the Environment Variable for the SSH-Agent.

I enabled SSH-Agent in my Home Config: services.ssh-agent.enable = true;

Then after Re-Logging, echo "$SSH_AUTH_SOCK" does return Nothing. (Happens on both, wayland and X11)

However the Home-Manager Module for ssh-agent should set the Environment Variables:

home.sessionVariablesExtra = ''
  if [ -z "$SSH_AUTH_SOCK" ]; then
    export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent
  fi
'';

I have Wondered if it could be related to Need mechanism to activate sessionVariables in Wayland sessions · Issue #2659 · nix-community/home-manager · GitHub, but because it happens on X11 too I’m not sure about it anymore.

The Host Config and other Home Config Stuff should be pretty standard for a Plasma 6 Install.
I need the SSH-Agent (and ENV-Variables) to comfortably unlock my SSH-Keys with KeePassXC.

Thanks for Helping! :slight_smile:

Best
kb

1 Like

I found a Solution!

Because Home-Manager doesn’t seem to work that great in this specific regard, I enabled the SSH-Agent System wide with programs.ssh.startAgent = true;

This Successfully sets the Environment Variables!

2 Likes

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.