nix-config/modules/home/ssh/default.nix
Bruno BELANYI e6c95245b2
All checks were successful
ci/woodpecker/push/check Pipeline was successful
home: ssh: disable default config
It's been deprecated.

This also makes my `addKeysToAgent` configuration more explicit.
2025-09-04 11:37:17 +00:00

72 lines
1.6 KiB
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.my.home.ssh;
in
{
options.my.home.ssh = with lib; {
enable = my.mkDisableOption "ssh configuration";
mosh = {
enable = my.mkDisableOption "mosh configuration";
package = mkPackageOption pkgs "mosh" { };
};
};
config = lib.mkIf cfg.enable (lib.mkMerge [
{
programs.ssh = {
enable = true;
enableDefaultConfig = false;
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";
};
# `*` is automatically made the last match block by the module
"*" = {
addKeysToAgent = "yes";
};
};
};
}
(lib.mkIf cfg.mosh.enable {
home.packages = [
cfg.mosh.package
];
})
]);
}