mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-06-16 01:55:13 -05:00
51 lines
829 B
Nix
Executable file
51 lines
829 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;
|
|
mars = devices.mars.name;
|
|
deimos = devices.deimos.name;
|
|
ceres = devices.ceres.name;
|
|
venus = devices.venus.name;
|
|
charon = devices.charon.name;
|
|
|
|
userLogic =
|
|
if
|
|
builtins.elem hostname [
|
|
mars
|
|
deimos
|
|
ceres
|
|
]
|
|
then
|
|
user0
|
|
else if hostname == charon then
|
|
user1
|
|
else if hostname == venus then
|
|
user2
|
|
else
|
|
"";
|
|
in
|
|
{
|
|
users.users =
|
|
if hostname == charon then
|
|
{ }
|
|
else
|
|
{
|
|
${userLogic} = {
|
|
openssh.authorizedKeys.keys = sshKeys;
|
|
};
|
|
};
|
|
}
|