blob: 2c79d347d6ee5cfbf802433655938ad22b61a38c (
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
|
{ config, lib, ... }:
let
hosts = [
{
domain = "github.com";
identityName = "github";
}
{
domain = "gitlab.com";
identityName = "gitlab";
}
{
domain = "bitbucket.org";
identityName = "bitbucket";
}
{
domain = "codeberg.org";
identityName = "codeberg";
}
{
domain = "git.sr.ht";
identityName = "sourcehut";
}
];
mkGitHost =
{ domain, identityName }:
lib.nameValuePair domain {
hostname = domain;
user = "git";
identityFile = "${config.home.homeDirectory}/.local/share/ssh/git/${identityName}";
};
mkKeyFile =
{ identityName, ... }:
lib.nameValuePair identityName {
enable = true;
text = "";
force = false;
};
in
{
config = lib.mkIf (config.security.ssh.enable && config.development.git.useSSH) {
home.file = builtins.listToAttrs (map mkKeyFile hosts);
programs.ssh.settings = builtins.listToAttrs (map mkGitHost hosts);
};
}
|