SECTION 04 / NIXOS
Home Manager & Nix
Let the module own the service, stable environment, incoming-agent registration, and SSH client setting.
Flake input
inputs.lanyard.url = "github:jwilger/lanyard-ssh-agent";Home Manager module
{ inputs, ... }: {
imports = [ inputs.lanyard.homeManagerModules.default ];
programs.lanyard-ssh-agent = {
enable = true;
upstream = "/home/me/.1password/agent.sock";
};
# Enable whichever shell Home Manager manages for you.
programs.zsh.enable = true;
}On Linux, the module installs a systemd user service and adds integration to Bash or Zsh when that shell is enabled through Home Manager. The hook registers an incoming forwarded socket before replacing SSH_AUTH_SOCK. The daemon owns both stable sockets; registration failure never blocks shell startup.
USE AN ABSOLUTE UPSTREAM PATHsystemd does not expand
$HOME in ExecStart. The default is your Home Manager home directory plus /.1password/agent.sock.Apple Silicon Darwin package and module outputs remain available, but the module does not install a launchd service or Linux/XDG shell integration there.
Manual SSH configuration
programs.ssh.settings."*".IdentityAgent = "SSH_AUTH_SOCK";ORDER MATTERSIf your shell overwrites
SSH_AUTH_SOCK first, the temporary forwarded path is lost. Capture, register, then export.