aboutsummaryrefslogtreecommitdiff
path: root/modules/home/tools/ssh/default.nix
blob: e34428ef8300ba919c9391596190934ab3cf6f26 (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
{ options, config, lib, pkgs, namespace, ... }:

with lib; with lib.${namespace}; let
  cfg = config.${namespace}.tools.ssh;
  impermanence = config.${namespace}.impermanence;
in {
  options.${namespace}.tools.ssh = with types; {
    enable = mkEnableOption "ssh";
  };

  config = mkIf cfg.enable {
    home.persistence.${impermanence.secure.location} = {
      directories = [
        ".ssh"
      ];
    };

    programs.ssh = {
      enable = true;

      #TODO: set up match block for copenhagen to enable forwarding
      enableDefaultConfig = false;
      matchBlocks."*" = { # old default config
        forwardAgent = false;
        addKeysToAgent = "no";

        compression = false;

        serverAliveInterval = 0;
        serverAliveCountMax = 3;

        hashKnownHosts = false;
        userKnownHostsFile = "~/.ssh/known_hosts";

        controlMaster = "no";
        controlPath = "~/.ssh/master-%r@%n:%p";
        controlPersist = "no";
      };
    };

    services.gpg-agent = {
      enableSshSupport = true;
      sshKeys = [ "1DC50342548C9CAACDD88211FF51697C3622D88A" ];
    };
  };
}