summaryrefslogtreecommitdiff
path: root/config/users.nix
diff options
context:
space:
mode:
authorquentin@aristote.fr <quentin@aristote.fr>2025-03-22 20:28:09 +0100
committerquentin@aristote.fr <quentin@aristote.fr>2025-03-22 21:09:52 +0100
commitbb6a5af93bae9d3b234d4352bdf476d56ef652d5 (patch)
tree90ee5d52356b583f46ea24bcfd55ea6e213b180e /config/users.nix
parent824f144cf0e0caf129cca8495a990ab99fffc045 (diff)
users: add kerberos remote builder
Diffstat (limited to 'config/users.nix')
-rw-r--r--config/users.nix44
1 files changed, 20 insertions, 24 deletions
diff --git a/config/users.nix b/config/users.nix
index 8dc27a3..777777c 100644
--- a/config/users.nix
+++ b/config/users.nix
@@ -1,29 +1,25 @@
-{pkgs, ...}: {
- personal.user.enable = true;
- users = {
- users = {
- nixremote = {
- isSystemUser = true;
- shell = pkgs.busybox-sandbox-shell;
- group = "nixremote";
- openssh.authorizedKeys.keys = [
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEgohiYF2Dsaq6ImGaslnKJMwpiVtwAaM9cm1tpSRr7t root@kerberos"
- ];
- };
- hermes = {
- isNormalUser = true;
- shell = pkgs.busybox-sandbox-shell;
- openssh.authorizedKeys.keys = [
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGstvYymapGvkjvKbFqkMZtE9ft9uEM13n8q798HtOT+ root@hermes"
- ];
- homeMode = "700";
- };
- };
- groups.nixremote = {};
+{
+ lib,
+ pkgs,
+ ...
+}: let
+ remoteBuildingUsers = {
+ hermes = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGstvYymapGvkjvKbFqkMZtE9ft9uEM13n8q798HtOT+ root@hermes";
+ kerberos = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEgohiYF2Dsaq6ImGaslnKJMwpiVtwAaM9cm1tpSRr7t root@kerberos";
};
+in {
+ personal.user.enable = true;
+ users.users =
+ builtins.mapAttrs (_: key: {
+ isNormalUser = true;
+ shell = pkgs.busybox-sandbox-shell;
+ openssh.authorizedKeys.keys = [key];
+ homeMode = "700";
+ })
+ remoteBuildingUsers;
- system.userActivationScripts.hermesSetup = ''
- if [ $(whoami) = hermes ]
+ system.userActivationScripts.remoteBuildingSetup = ''
+ if [[ $(whoami) = @(${lib.concatStringsSep "|" (builtins.attrNames remoteBuildingUsers)}) ]]
then
mkdir --parents --mode=700 nixos-configuration
git init --bare nixos-configuration