From e48372c62909c3786f6525aa477744845fa056d5 Mon Sep 17 00:00:00 2001 From: moons-14 Date: Sat, 1 Nov 2025 06:33:27 +0900 Subject: [PATCH] fix --- modules/home/ssh.nix | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/home/ssh.nix b/modules/home/ssh.nix index 6cfaf48..c32ce89 100644 --- a/modules/home/ssh.nix +++ b/modules/home/ssh.nix @@ -3,22 +3,27 @@ home.packages = [ pkgs.openssh ]; + programs.ssh = { + enable = true; + startAgent = true; + extraConfig = '' + Host * + AddKeysToAgent yes + IdentityFile ~/.ssh/id_ed25519 + ''; + }; + home.activation.generateSshKey = lib.hm.dag.entryAfter [ "writeBoundary" ] '' key="$HOME/.ssh/id_ed25519" if [ ! -f "$key" ]; then umask 077 mkdir -p "$HOME/.ssh" - ssh-keygen -t ed25519 -N "" -f "$key" -C "moons@$(hostnamectl --static 2>/dev/null || echo host)" + ${pkgs.openssh}/bin/ssh-keygen -t ed25519 -N "" -f "$key" \ + -C "moons@$(hostnamectl --static 2>/dev/null || echo host)" echo "Generated SSH key at $key" fi ''; - home.file.".ssh/config".text = '' - Host * - AddKeysToAgent yes - IdentityFile ~/.ssh/id_ed25519 - ''; - programs.git = { enable = true;