summaryrefslogtreecommitdiff
path: root/users/root.nix
blob: 24a5ae94ee2d57e96aa9e78a0ad7c7fba14f6d4b (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 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;
        hashKnownHosts = true;
        extraConfig = ''
          IdentitiesOnly true
          ServerAliveCountMax 10
        '';
      };

      gpg.enable = true;
    };

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