dotfiles/nixos/modules/ssh.nix
2025-01-30 13:38:29 -06:00

36 lines
618 B
Nix
Executable file

{
flake,
config,
...
}:
let
inherit (flake.config.people)
user0
user2
;
inherit (flake.config.people.users.${userLogic})
sshKeys
;
inherit (flake.config.machines)
devices
;
hostname = config.networking.hostName;
desktop = devices.desktop.name;
server = devices.server.name;
fallaryn = devices.fallaryn.name;
userLogic =
if hostname == desktop then
user0
else if hostname == server then
user0
else if hostname == fallaryn then
user2
else
"";
in
{
users.users.${userLogic} = {
openssh.authorizedKeys.keys = sshKeys;
};
}