From b2595f1936399fd95ff7e163a4c3abf54ce424b4 Mon Sep 17 00:00:00 2001 From: foehammer127 Date: Sun, 26 Jan 2025 19:21:36 -0600 Subject: [PATCH] Add admin user. --- nixos/common/users/admin.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 nixos/common/users/admin.nix diff --git a/nixos/common/users/admin.nix b/nixos/common/users/admin.nix new file mode 100644 index 0000000..93580a4 --- /dev/null +++ b/nixos/common/users/admin.nix @@ -0,0 +1,26 @@ +{ + config, + lib, + foelib, + ... +}: let + inherit (lib) mkIf mkEnableOption optionals; + cfg = config.foehammer.users.admin; +in { + options.foehammer.users.admin.enable = mkEnableOption "Enable a wheel admin user."; + config = mkIf cfg.enable { + users.users.admin = { + createHome = true; + description = "SSH Admin User."; + group = "admin"; + + extraGroups = ["wheel"] ++ optionals config.virtualisation.docker.enable ["docker"]; + isNormalUser = true; + uid = 9999; + + openssh.authorizedKeys.keys = foelib.getSSHKeys "foehammer"; + }; + + users.groups.admin.gid = config.users.users.admin.uid; + }; +}