Skip to content

Commit

Permalink
home (terminal): Configure ssh for easier access to my homelab
Browse files Browse the repository at this point in the history
  • Loading branch information
britter committed Nov 21, 2024
1 parent c08c11a commit fd3e096
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
2 changes: 2 additions & 0 deletions home/terminal/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ in {
./gpg
./helix.nix
./nvim
./ssh.nix
./tmux.nix
./tools.nix
./yazi.nix
Expand All @@ -35,6 +36,7 @@ in {
gpg.enable = true;
helix.enable = true;
nvim.enable = true;
ssh.enable = true;
tmux.enable = true;
tools.enable = true;
yazi.enable = true;
Expand Down
57 changes: 57 additions & 0 deletions home/terminal/ssh.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
config,
lib,
osConfig,
...
}: let
cfg = config.my.home.terminal.ssh;
in {
options.my.home.terminal.ssh = {
enable = lib.mkEnableOption "ssh";
};
config = lib.mkIf cfg.enable {
programs.ssh = {
enable = true;
matchBlocks = let
sshDirectory = "${config.home.homeDirectory}/.ssh";
privateKey = "${sshDirectory}/id_ed25519";
in {
"github.com" = {
hostname = "github.com";
identityFile = privateKey;
identitiesOnly = true;
};
directions = {
hostname = osConfig.my.homelab.directions.ip;
identityFile = privateKey;
user = "root";
};
"srv-prod-1" = {
hostname = osConfig.my.homelab.srv-prod-1.ip;
identityFile = privateKey;
user = "root";
};
"srv-prod-2" = {
hostname = osConfig.my.homelab.srv-prod-2.ip;
identityFile = privateKey;
user = "root";
};
"srv-test-1" = {
hostname = osConfig.my.homelab.srv-test-1.ip;
identityFile = privateKey;
user = "root";
};
"srv-test-2" = {
hostname = osConfig.my.homelab.srv-test-2.ip;
identityFile = privateKey;
user = "root";
};
"srv-eval-1" = {
hostname = osConfig.my.homelab.srv-eval-1.ip;
identityFile = privateKey;
user = "root";
};
};
};
};
}

0 comments on commit fd3e096

Please sign in to comment.