summaryrefslogtreecommitdiff
path: root/config/users.nix
blob: 777777c6945f02192f691abe3e830a85356d005d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
  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.remoteBuildingSetup = ''
    if [[ $(whoami) = @(${lib.concatStringsSep "|" (builtins.attrNames remoteBuildingUsers)}) ]]
    then
      mkdir --parents --mode=700 nixos-configuration
      git init --bare nixos-configuration
    fi
  '';
}