dotfiles/nixos/modules/ssh.nix

45 lines
764 B
Nix
Raw Normal View History

{
flake,
config,
...
}:
let
inherit (flake.config.people)
2025-01-08 19:06:14 -06:00
user0
2025-01-31 01:49:36 -06:00
user1
user2
2025-01-08 19:06:14 -06:00
;
inherit (flake.config.people.users.${userLogic})
2025-01-08 19:06:14 -06:00
sshKeys
;
inherit (flake.config.machines)
devices
;
hostname = config.networking.hostName;
2025-01-30 13:38:29 -06:00
desktop = devices.desktop.name;
server = devices.server.name;
fallaryn = devices.fallaryn.name;
2025-01-31 01:49:36 -06:00
bartholomew = devices.bartholomew.name;
userLogic =
2025-01-30 13:38:29 -06:00
if hostname == desktop then
user0
2025-01-30 13:38:29 -06:00
else if hostname == server then
user0
else if hostname == fallaryn then
user2
else
"";
in
{
2025-01-31 01:49:36 -06:00
users.users =
if hostname == bartholomew then
{ }
else
{
${userLogic} = {
openssh.authorizedKeys.keys = sshKeys;
};
};
2024-10-06 15:25:05 -05:00
}