Commit e92e414e6ac9

Vincent Demeester <vincent@sbr.pm>
2026-06-11 13:29:24
fix(aomi): set ssh-tpm-agent socket in systemd user env
Add an environment.d entry so the systemd user manager exports SSH_AUTH_SOCK pointing at ssh-tpm-agent, ensuring GUI terminals spawned under niri use the TPM front agent instead of the bare FIDO2 agent.
1 parent 60a1dea
Changed files (1)
home
common
home/common/shell/openssh.nix
@@ -65,6 +65,15 @@ in
     # Route ssh through the front ssh-tpm-agent (TPM key + proxied FIDO2 keys).
     SSH_AUTH_SOCK = lib.mkForce "$XDG_RUNTIME_DIR/ssh-tpm-agent.sock";
   };
+
+  # The hm-session-vars export above only affects login shells. GUI terminals
+  # spawned under niri inherit the systemd user manager environment, so set
+  # SSH_AUTH_SOCK there too via environment.d (read by the user manager at login).
+  xdg.configFile = lib.mkIf isAomi {
+    "environment.d/95-ssh-auth-sock.conf".text = ''
+      SSH_AUTH_SOCK=''${XDG_RUNTIME_DIR}/ssh-tpm-agent.sock
+    '';
+  };
   programs.ssh = {
     enable = true;
     enableDefaultConfig = false;