nix-config/modules/home/ssh/default.nix

71 lines
1.4 KiB
Nix
Raw Permalink Normal View History

2023-12-07 15:31:32 +01:00
{ config, lib, pkgs, ... }:
2021-03-13 01:02:28 +01:00
let
cfg = config.my.home.ssh;
in
2021-02-20 16:25:55 +01:00
{
2023-03-16 17:39:13 +01:00
options.my.home.ssh = with lib; {
enable = my.mkDisableOption "ssh configuration";
2023-12-07 15:31:32 +01:00
mosh = {
enable = my.mkDisableOption "mosh configuration";
package = mkPackageOption pkgs "mosh" { };
};
2021-03-13 01:02:28 +01:00
};
config = lib.mkIf cfg.enable (lib.mkMerge [
{
programs.ssh = {
enable = true;
includes = [
# Local configuration, not-versioned
"config.local"
];
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 = "37.187.146.15";
identityFile = "~/.ssh/shared_rsa";
user = "ambroisie";
};
};
extraConfig = ''
AddKeysToAgent yes
'';
2021-02-20 16:25:55 +01:00
};
}
2023-12-07 15:31:32 +01:00
(lib.mkIf cfg.mosh.enable {
home.packages = [
cfg.mosh.package
];
})
]);
2021-02-20 16:25:55 +01:00
}