dotfiles/modules/nixos/core/ssh/default.nix

44 lines
746 B
Nix
Executable file

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