feat: generalize SSH key config

This commit is contained in:
2026-04-26 19:40:29 +02:00
parent 0318dd0cf6
commit 52ea09563f
6 changed files with 34 additions and 48 deletions
+2 -2
View File
@@ -17,8 +17,8 @@ in
scope:
let
email = account.emails.${scope}.address;
key = machine.sourceControl.${scope};
hasSigningKey = key != null && key.publicKey != null;
key = lib.attrByPath [ scope ] null machine.sshKeys;
hasSigningKey = key != null;
in
{
allowedSigners = lib.optional hasSigningKey "${email} ${key.publicKey}";
+8 -1
View File
@@ -1,6 +1,11 @@
{ config, ... }:
{ config, lib, ... }:
let
account = config.repo.account;
personalPublicKeys =
machines:
map (machine: machine.sshKeys.personal.publicKey) (
lib.filter (machine: machine.sshKeys ? personal) (builtins.attrValues machines)
);
in
{
flake.modules.nixos.ssh-agent-auth = {
@@ -23,5 +28,7 @@ in
AllowUsers = [ account.name ];
};
};
users.users.${account.name}.openssh.authorizedKeys.keys = personalPublicKeys config.repo.machines;
};
}