2026-01-01 01:36:58 -05:00
|
|
|
{ pkgs, inputs, config, keys, ... }: {
|
2026-04-04 04:57:47 -04:00
|
|
|
users.users.ai-worker = {
|
2026-01-01 01:36:58 -05:00
|
|
|
isSystemUser = true;
|
2026-04-04 04:57:47 -04:00
|
|
|
group = "ai-worker";
|
2026-04-04 17:07:13 -04:00
|
|
|
home = "/home/ai-worker";
|
|
|
|
|
createHome = true;
|
2026-01-01 01:36:58 -05:00
|
|
|
extraGroups = [ "docker" ];
|
|
|
|
|
shell = pkgs.bashInteractive;
|
|
|
|
|
openssh.authorizedKeys.keys = [
|
2026-04-04 04:57:47 -04:00
|
|
|
keys.users.ai-worker.main
|
2026-01-01 01:36:58 -05:00
|
|
|
];
|
2026-04-28 15:34:38 +00:00
|
|
|
# No password login - SSH key only
|
|
|
|
|
hashedPassword = "!";
|
2026-01-01 01:36:58 -05:00
|
|
|
};
|
2026-04-04 04:57:47 -04:00
|
|
|
users.groups.ai-worker = {};
|
2026-04-28 15:34:38 +00:00
|
|
|
|
|
|
|
|
# Enable restricted AI worker access with deployment capabilities
|
|
|
|
|
# SECURITY: ai-worker can only:
|
|
|
|
|
# - Access /home/ai-worker/infra (bind-mounted to /home/gortium/infra)
|
|
|
|
|
# - Run: nh, nixos-rebuild, nixpkgs-fmt, nix (via sudo, no password)
|
|
|
|
|
# - Manage docker containers (via docker group)
|
|
|
|
|
# - All changes to infra/ are logged via audit subsystem
|
|
|
|
|
# WORKFLOW: AI must ask for user confirmation before running nh os switch
|
|
|
|
|
services.aiWorkerAccess = true;
|
2026-01-01 02:25:34 -05:00
|
|
|
}
|