aboutsummaryrefslogtreecommitdiffstats
path: root/modules/security/ssh/git.nix
blob: 23b52abeddb446809d1a71a1a161a87f285ef1a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Git - SSH host configurations for git platforms (github, gitlab, bitbucket, codeberg, sr.ht)
{ config, lib, ... }:
let
  hosts = [
    "github.com"
    "gitlab.com"
    "bitbucket.org"
    "codeberg.org"
    "git.sr.ht"
  ];

  mkGitHost =
    domain:
    lib.nameValuePair domain {
      hostname = domain;
      user = "git";
    };
in
{
  config = lib.mkIf (config.security.ssh.enable && config.development.git.useSSH) {
    programs.ssh.settings = builtins.listToAttrs (map mkGitHost hosts);
  };
}