summaryrefslogtreecommitdiff
path: root/users/root.nix
blob: b61f9cfdf8f4c8a11ff2468500b9d4a878186469 (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
46
47
48
49
50
51
52
{ flake, lib, config, hostName, userName, pkgs, ... }:
let
  haveGKleen = flake.nixosModules.accounts ? "gkleen@${hostName}";
in {
  imports = with flake.nixosModules.userProfiles.${userName}; [
    zsh tmux direnv utils
  ];

  users.users.${userName} = lib.mkIf haveGKleen {
    inherit (config.users.users."gkleen") hashedPassword shell;
    openssh.authorizedKeys.keyFiles = config.users.users."gkleen".openssh.authorizedKeys.keyFiles;
  };

  home-manager.users.${userName} = {
    programs = {
      git = {
        enable = true;
        userEmail = "gkleen@yggdrasil.li";
        userName = "Gregor Kleen";
        delta.enable = true;
        extraConfig = {
          pull.rebase = false;
        };
      };

      ssh = {
        enable = true;
        controlMaster = "auto";
        controlPersist = "30m";
        serverAliveInterval = 6;
        serverAliveCountMax = 10;
        hashKnownHosts = true;
        extraConfig = ''
          IdentitiesOnly true
        '';
      };

      gpg.enable = true;
    };

    services = {
      gpg-agent = {
        enable = true;
        enableSshSupport = true;
        extraConfig = ''
          pinentry-program ${pkgs.pinentry-curses}/bin/pinentry
          grab
        '';
      };
    };
  };
}