summaryrefslogtreecommitdiff
path: root/users.nix
blob: d528ff0583f772fadc53900db78170e0735dc17c (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{
  config,
  lib,
  machine,
  ...
}: let
  machines = import ./machines.nix;
in {
  users.users =
    builtins.mapAttrs
    (name: value: lib.mkIf (builtins.elem name machine.users) value)
    {
      "andromeda" = {
        isNormalUser = true;
        description = "andromeda";
        hashedPasswordFile = builtins.toString config.age.secrets.andromeda-pw.path;
        extraGroups = [
          "networkmanager"
          "wheel"
        ];
      };
    };
  environment.persistence."/persist".users = lib.mkIf config.environment.persistence."/persist".enable (
    builtins.mapAttrs
    (name: value: lib.mkIf (builtins.elem name machine.users) value)
    {
      "andromeda" = {
        directories = [
          ".backups"
          ".local/share/Anki2"
          ".local/share/chat.fluffy.fluffychat"
          ".local/share/zoxide"
          ".ssh"
          "conf"
          "Downloads"
          "pp"
        ];
        files = [
          ".bash_history"
          ".brush_history"
        ];
      };
    }
  );
}