nixos/home/modules/ssh.nix
2024-07-11 06:12:12 -07:00

42 lines
1 KiB
Nix

{ lib, config, ... }:
let
cfg = config.snowhawk.ssh;
in
{
options.snowhawk.ssh = {
enable = lib.mkEnableOption "ssh";
homeNetwork = lib.mkEnableOption "include local hostnames for home network devices";
};
config = lib.mkIf cfg.enable {
programs.ssh = {
enable = true;
includes = [
"conf.d/*"
];
matchBlocks = {
"git.zynh.me" = {
hostname = "git.zynh.me";
user = "git";
port = 2221;
identityFile = "${config.home.homeDirectory}/.ssh/personal_git";
};
msiserver = {
hostname = "scarlet.zynh.me";
user = "zynh";
identityFile = "${config.home.homeDirectory}/.ssh/msiserver";
};
"msiserver.local" = lib.mkIf cfg.homeNetwork {
hostname = "msiserver";
user = "zynh";
identityFile = "${config.home.homeDirectory}/.ssh/msiserver";
};
caveserver = {
identityFile = "${config.home.homeDirectory}/.ssh/caveserver";
};
};
};
};
}