summaryrefslogtreecommitdiff
path: root/lib/ssh.nix
blob: c6a73f2e5f76b733e9106439f9de1393575dabd0 (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
{ ... }:

let
  homedir = builtins.getEnv "HOME";
in {
  programs.ssh = {
    controlMaster = "auto";
    enable = true;
    forwardAgent = true;
    matchBlocks = {
      "beryllium" = {
        hostname = "beryllium";
        forwardAgent = true;
        remoteForwards = let path = a: b: {host.address = a; bind.address = b;};
        in [
          ( path
            "/run/user/1000/gnupg/S.gpg-agent.extra"
            "/run/user/1000/gnupg/S.gpg-agent.extra"
          )
          ( path
            "/run/user/1000/gnupg/S.gpg-agent"
            "/run/user/1000/gnupg/S.gpg-agent"
          )
        ];
        extraOptions = {
          "StreamLocalBindUnlink" = "yes";
        };
      };
    };
  };
}