home: ssh: use 'mkMerge'

This will make it easier to add new options (e.g: for `mosh`).
This commit is contained in:
Bruno BELANYI 2023-12-07 14:29:59 +00:00
parent 8398c4350a
commit 0b9c2309da
1 changed files with 45 additions and 41 deletions

View File

@ -7,48 +7,52 @@ in
enable = my.mkDisableOption "ssh configuration";
};
config.programs.ssh = lib.mkIf cfg.enable {
enable = true;
config = lib.mkIf cfg.enable (lib.mkMerge [
{
programs.ssh = {
enable = true;
includes = [
# Local configuration, not-versioned
"config.local"
];
includes = [
# Local configuration, not-versioned
"config.local"
];
matchBlocks = {
"github.com" = {
hostname = "github.com";
identityFile = "~/.ssh/shared_rsa";
user = "git";
matchBlocks = {
"github.com" = {
hostname = "github.com";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
"gitlab.com" = {
hostname = "gitlab.com";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
"git.sr.ht" = {
hostname = "git.sr.ht";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
"git.belanyi.fr" = {
hostname = "git.belanyi.fr";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
porthos = {
hostname = "91.121.177.163";
identityFile = "~/.ssh/shared_rsa";
user = "ambroisie";
};
};
extraConfig = ''
AddKeysToAgent yes
'';
};
"gitlab.com" = {
hostname = "gitlab.com";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
"git.sr.ht" = {
hostname = "git.sr.ht";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
"git.belanyi.fr" = {
hostname = "git.belanyi.fr";
identityFile = "~/.ssh/shared_rsa";
user = "git";
};
porthos = {
hostname = "91.121.177.163";
identityFile = "~/.ssh/shared_rsa";
user = "ambroisie";
};
};
extraConfig = ''
AddKeysToAgent yes
'';
};
}
]);
}