aboutsummaryrefslogtreecommitdiffstats
path: root/modules/tools/openssh/default.nix
blob: f97ff4508055935a9a5d13d8da804110e73d9d25 (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
{
  config,
  lib,
  pkgs,
  ...
}:

{
  options.tools.openssh = {
    enable = lib.mkEnableOption "Enables OpenSSH client.";
  };

  config = lib.mkIf config.tools.openssh.enable {
    programs.ssh = {
      enable = true;
      package = pkgs.openssh;
      enableDefaultConfig = false;
      extraOptionOverrides = {
        AddKeysToAgent = "yes";
        ForwardAgent = "yes";
        ServerAliveInterval = "60";
        ServerAliveCountMax = "3";
        VisualHostKey = "yes";
        HashKnownHosts = "yes";
      };
      matchBlocks = {
        "github.com" = {
          hostname = "github.com";
          user = "git";
          identityFile = "${config.home.homeDirectory}/.ssh/github";
        };
      };
    };

    home.file.".ssh/config".text = ''
      Include ~/.ssh/config.d/*.conf
    '';
  };
}