infra/modules/nixos/community-builder/users.nix

74 lines
1.5 KiB
Nix
Raw Normal View History

2022-01-09 15:40:38 +01:00
{ pkgs, ... }:
2022-01-09 15:34:55 +01:00
let
inherit (pkgs) lib;
users = {
# 1. Generate an SSH key for your root account and add the public
# key to a file matching your name in ./keys/
#
# 2. Copy / paste this in order, alphabetically:
#
2022-01-16 10:23:57 -05:00
# youruser.keys = ./keys/youruser;
#
"0x4A6F".keys = ./keys/0x4A6F;
2022-01-09 15:34:55 +01:00
a-kenji.keys = ./keys/a-kenji;
2022-09-27 13:15:23 +02:00
2023-08-08 17:21:15 +08:00
bobby285271.keys = ./keys/bobby285271;
ckie.keys = ./keys/ckie;
fgaz.keys = ./keys/fgaz;
2022-08-22 14:01:20 +02:00
flokli.keys = ./keys/flokli;
janik.keys = ./keys/janik;
2023-07-25 17:37:58 +02:00
jtojnar.keys = ./keys/jtojnar;
2022-01-16 10:23:57 -05:00
lewo.keys = ./keys/lewo;
lily.keys = ./keys/lily;
2023-07-27 15:19:33 -04:00
raitobezarius.keys = ./keys/raitobezarius;
2022-12-31 07:24:17 +01:00
networkexception.keys = ./keys/networkexception;
schmittlauch.keys = ./keys/schmittlauch;
2022-08-30 01:51:22 +02:00
2023-04-23 11:33:59 +02:00
stephank.keys = ./keys/stephank;
2022-01-16 10:23:57 -05:00
winter.keys = ./keys/winter;
2022-01-09 15:34:55 +01:00
};
ifAttr = key: default: result: opts:
if (opts ? "${key}") && opts."${key}"
2022-08-14 16:49:30 +02:00
then result
else default;
2022-01-09 15:34:55 +01:00
2022-08-14 16:49:30 +02:00
maybeTrusted = ifAttr "trusted" [ ] [ "trusted" ];
maybeWheel = ifAttr "sudo" [ ] [ "wheel" ];
2022-01-09 15:34:55 +01:00
userGroups = opts:
(maybeTrusted opts) ++
(maybeWheel opts);
descToUser = name: opts:
{
isNormalUser = true;
extraGroups = userGroups opts;
createHome = true;
home = "/home/${name}";
hashedPassword = opts.password or null;
openssh.authorizedKeys.keyFiles = [
opts.keys
];
};
2022-08-14 16:49:30 +02:00
in
{
2022-01-09 15:34:55 +01:00
users = {
mutableUsers = false;
users = lib.mapAttrs descToUser users;
};
}