Skip to content

Commit ac1c950

Browse files
committed
fix(core): don't add authorized_keys when it already has it
1 parent f1302e6 commit ac1c950

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/core.nix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ in
5151
if [ ! -f ${config.home.homeDirectory}/.ssh/authorized_keys ]; then
5252
touch ${config.home.homeDirectory}/.ssh/authorized_keys
5353
fi
54-
(cat ${config.home.homeDirectory}/.ssh/id_ed25519.pub) >> ${config.home.homeDirectory}/.ssh/authorized_keys
54+
if grep -q "charles@home-manager" "${config.home.homeDirectory}/.ssh/authorized_keys"; then
55+
exit 0
56+
else
57+
(cat ${config.home.homeDirectory}/.ssh/id_ed25519.pub) >> ${config.home.homeDirectory}/.ssh/authorized_keys
58+
fi
5559
'';
5660
gpgFixup = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
5761
if [ ! -d ${config.xdg.dataHome}/gnupg ]; then

0 commit comments

Comments
 (0)