mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-12-08 05:49:25 -06:00
42 lines
722 B
Nix
42 lines
722 B
Nix
|
|
{
|
||
|
|
flake,
|
||
|
|
config,
|
||
|
|
...
|
||
|
|
}:
|
||
|
|
let
|
||
|
|
inherit (flake.config.people) user0 user1;
|
||
|
|
inherit (flake.config.machines) devices;
|
||
|
|
hostname = config.networking.hostName;
|
||
|
|
mars = devices.mars.name;
|
||
|
|
deimos = devices.deimos.name;
|
||
|
|
ceres = devices.ceres.name;
|
||
|
|
|
||
|
|
getUserKeys = user: flake.config.people.users.${user}.sshKeys;
|
||
|
|
|
||
|
|
user0Key = {
|
||
|
|
${user0} = {
|
||
|
|
openssh.authorizedKeys.keys = getUserKeys user0;
|
||
|
|
};
|
||
|
|
};
|
||
|
|
user1Key = {
|
||
|
|
${user1} = {
|
||
|
|
openssh.authorizedKeys.keys = getUserKeys user1;
|
||
|
|
};
|
||
|
|
};
|
||
|
|
|
||
|
|
in
|
||
|
|
{
|
||
|
|
users.users =
|
||
|
|
if hostname == mars then
|
||
|
|
user0Key // user1Key
|
||
|
|
else if
|
||
|
|
builtins.elem hostname [
|
||
|
|
deimos
|
||
|
|
ceres
|
||
|
|
]
|
||
|
|
then
|
||
|
|
user0Key
|
||
|
|
else
|
||
|
|
{ };
|
||
|
|
}
|