From fb5ed25b5817453d964fb567fe6035a228ab99bf Mon Sep 17 00:00:00 2001
From: Anthony Rodriguez <anthony@nezia.dev>
Date: Thu, 30 Jan 2025 15:05:48 +0100
Subject: [PATCH] services/ssh: add keys to agent automatically

---
 modules/services/ssh.nix | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/modules/services/ssh.nix b/modules/services/ssh.nix
index 6c910f5..b63c4ab 100644
--- a/modules/services/ssh.nix
+++ b/modules/services/ssh.nix
@@ -2,10 +2,20 @@
   lib,
   config,
   ...
-}: {
+}: let
+  inherit (config.local.systemVars) username;
+in {
   config = lib.mkIf config.local.profiles.desktop.enable {
     programs.ssh = {
       startAgent = true;
     };
+
+    hjem.users.${username} = {
+      files = {
+        ".ssh/config".text = ''
+          AddKeysToAgent yes
+        '';
+      };
+    };
   };
 }