Extract away the ssh-client config.

Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
Mariano Uvalle 2025-06-03 22:08:35 -07:00
parent 60aa11b540
commit 454eb03119
2 changed files with 59 additions and 48 deletions

View file

@ -0,0 +1,55 @@
{ lib, config, ... } : {
options.ssh-client = {
add-alarm = lib.mkEnableOption "add the alarm match block";
};
config.services.ssh-agent.enable = true;
config.programs.ssh = {
enable = true;
addKeysToAgent = "yes";
matchBlocks = {
"git" = {
host = "github.com";
user = "git";
identityFile = [
"/home/jmug/.ssh/id_yubikey" # Auto updated symlik that matches all yubikeys.
"/home/jmug/.ssh/id_jmug" # Fallback key with passphrase.
];
};
"forgejo" = {
host = "code.jmug.me";
user = "forgejo";
identityFile = [
"/home/jmug/.ssh/id_yubikey" # Auto updated symlik that matches all yubikeys.
"/home/jmug/.ssh/id_jmug" # Fallback key with passphrase.
];
};
wsl = {
user = "jmug";
hostname = "192.168.10.241";
port = 69;
forwardAgent = true;
identityFile = [
"/home/jmug/.ssh/id_yubikey" # Auto updated symlik that matches all yubikeys.
];
};
ws = {
user = "jmug";
hostname = "98.59.213.212";
port = 69;
forwardAgent = true;
identityFile = [
"/home/jmug/.ssh/id_yubikey" # Auto updated symlik that matches all yubikeys.
];
};
} // lib.optionalAttrs config.ssh-client.add-alarm {
alarm = {
user = "alarm";
hostname = "alarm";
forwardAgent = true;
identityFile = "/home/jmug/.ssh/id_ed25519";
};
};
};
}

View file

@ -25,8 +25,12 @@ in
../../home-modules/books.nix ../../home-modules/books.nix
../../home-modules/ghostty-config.nix ../../home-modules/ghostty-config.nix
../../home-modules/sops.nix ../../home-modules/sops.nix
../../home-modules/ssh-client.nix
]; ];
# Add the match block for the rasp alarm.
ssh-client.add-alarm = true;
# Let home manager start the X11 session. # Let home manager start the X11 session.
xsession = { xsession = {
enable = true; enable = true;
@ -302,54 +306,6 @@ in
}; };
}; };
services.ssh-agent.enable = true;
programs.ssh = {
enable = true;
addKeysToAgent = "yes";
matchBlocks = {
"git" = {
host = "github.com";
user = "git";
identityFile = [
"/home/jmug/.ssh/id_yubikey" # Auto updated symlik that matches all yubikeys.
"/home/jmug/.ssh/id_jmug" # Fallback key with passphrase.
];
};
"forgejo" = {
host = "code.jmug.me";
user = "forgejo";
identityFile = [
"/home/jmug/.ssh/id_yubikey" # Auto updated symlik that matches all yubikeys.
"/home/jmug/.ssh/id_jmug" # Fallback key with passphrase.
];
};
alarm = {
user = "alarm";
hostname = "alarm";
forwardAgent = true;
identityFile = "/home/jmug/.ssh/id_ed25519";
};
wsl = {
user = "jmug";
hostname = "192.168.10.241";
port = 69;
forwardAgent = true;
identityFile = [
"/home/jmug/.ssh/id_yubikey" # Auto updated symlik that matches all yubikeys.
];
};
ws = {
user = "jmug";
hostname = "98.59.213.212";
port = 69;
forwardAgent = true;
identityFile = [
"/home/jmug/.ssh/id_yubikey" # Auto updated symlik that matches all yubikeys.
];
};
};
};
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
programs.home-manager.enable = true; programs.home-manager.enable = true;
} }