mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-06-16 10:05:13 -05:00
feat: init
This commit is contained in:
commit
96c6f790fc
804 changed files with 33411 additions and 0 deletions
58
modules/nixos/core/ssh/default.nix
Executable file
58
modules/nixos/core/ssh/default.nix
Executable file
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
flake,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (flake.config.people)
|
||||
user0
|
||||
user1
|
||||
user2
|
||||
user3
|
||||
;
|
||||
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;
|
||||
|
||||
# Helper function to get SSH keys for a specific user
|
||||
getUserKeys = user: flake.config.people.users.${user}.sshKeys;
|
||||
in
|
||||
{
|
||||
users.users =
|
||||
if hostname == charon then
|
||||
{ }
|
||||
else if hostname == mars then
|
||||
{
|
||||
${user0} = {
|
||||
openssh.authorizedKeys.keys = getUserKeys user0;
|
||||
};
|
||||
${user3} = {
|
||||
openssh.authorizedKeys.keys = getUserKeys user3;
|
||||
};
|
||||
}
|
||||
else if
|
||||
builtins.elem hostname [
|
||||
deimos
|
||||
ceres
|
||||
]
|
||||
then
|
||||
{
|
||||
${user0} = {
|
||||
openssh.authorizedKeys.keys = getUserKeys user0;
|
||||
};
|
||||
}
|
||||
else if hostname == venus then
|
||||
{
|
||||
${user2} = {
|
||||
openssh.authorizedKeys.keys = getUserKeys user2;
|
||||
};
|
||||
}
|
||||
else
|
||||
{ };
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue