接入 sops 管理 SSH 配置与私钥

This commit is contained in:
2026-01-19 23:36:42 +08:00
parent e195cbc591
commit 2f31fbcd6e
13 changed files with 114 additions and 25 deletions
+29
View File
@@ -0,0 +1,29 @@
{ config, lib, ... }:
{
sops = {
age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt";
defaultSopsFile = ../../secrets/ssh-config.yaml;
};
home.file.".ssh" = {
source = ./ssh;
recursive = true;
};
home.activation.sshDirPerms = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
if [ -d "$HOME/.ssh" ]; then
chmod 700 "$HOME/.ssh"
fi
'';
sops.secrets."ssh-config" = {
path = "${config.home.homeDirectory}/.ssh/config";
mode = "600";
};
sops.secrets."ssh-private" = {
sopsFile = ../../secrets/ssh-private.yaml;
path = "${config.home.homeDirectory}/.ssh/id_ed25519";
mode = "600";
};
}