Restructure SSH config similar to Git for personal/work separation

This commit is contained in:
Evie Litherland-Smith 2023-05-05 13:29:39 +01:00
parent 5002cf9d48
commit 5018fbbee5
10 changed files with 52 additions and 66 deletions

View file

@ -6,8 +6,8 @@
./env/bat.nix ./env/bat.nix
./env/direnv.nix ./env/direnv.nix
./env/keychain.nix ./env/keychain.nix
./env/ssh.nix
./env/starship.nix ./env/starship.nix
./ssh/personal.nix
./terminal/wezterm.nix ./terminal/wezterm.nix
./tui/neovim.nix ./tui/neovim.nix
./tui/lazygit.nix ./tui/lazygit.nix

View file

@ -9,7 +9,6 @@
../../env/direnv.nix ../../env/direnv.nix
../../env/keychain.nix ../../env/keychain.nix
../../env/pypoetry.nix ../../env/pypoetry.nix
../../env/ssh.nix
../../env/starship.nix ../../env/starship.nix
../../terminal/wezterm.nix ../../terminal/wezterm.nix
../../tui/neovim.nix ../../tui/neovim.nix

View file

@ -3,20 +3,8 @@
imports = [ imports = [
../common/desktop.nix ../common/desktop.nix
../../git/personal.nix ../../git/personal.nix
../../ssh/personal.nix
]; ];
programs.ssh.matchBlocks = {
"legion xenia xenia.me.uk" = {
user = "xenia";
hostname = "xenia.me.uk";
port = 30;
forwardAgent = true;
};
"vanguard" = {
user = "xenia";
hostname = "192.168.1.166";
forwardAgent = true;
};
};
home.packages = with pkgs; [ home.packages = with pkgs; [
discord discord
element-desktop element-desktop

View file

@ -1,34 +1,10 @@
{ pkgs, lib, ... }: { pkgs, ... }:
{ {
imports = [ imports = [
../common/desktop.nix ../common/desktop.nix
../../git/work.nix ../../git/work.nix
../../ssh/work.nix
]; ];
programs.ssh.matchBlocks = {
"batch" = {
user = "cxsbatch";
hostname = "heimdall115.jetdata.eu";
};
"jupyter" = {
hostname = "freia022.hpc.l";
localForwards = [
{
bind.port = 6702;
host.address = "localhost";
host.port = 6702;
}
];
};
"freia" = {
hostname = "freia022.hpc.l";
};
"freia???" = lib.hm.dag.entryAfter [ "freia" ] {
hostname = "%h.hpc.l";
};
"freia* jupyter" = lib.hm.dag.entryAfter [ "freia" "freia???" "jupyter" ] {
user = "elitherl";
};
};
home.packages = with pkgs; [ home.packages = with pkgs; [
libreoffice-fresh libreoffice-fresh
neovide neovide

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { ... }:
{ {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
@ -9,5 +9,4 @@
controlPersist = "1s"; controlPersist = "1s";
matchBlocks."git.*".user = "git"; matchBlocks."git.*".user = "git";
}; };
home.packages = with pkgs; [ sshfs ];
} }

17
home/ssh/personal.nix Normal file
View file

@ -0,0 +1,17 @@
{ ... }:
{
imports = [ ./common.nix ];
programs.ssh.matchBlocks = {
"legion xenia xenia.me.uk" = {
user = "xenia";
hostname = "xenia.me.uk";
port = 30;
forwardAgent = true;
};
"vanguard" = {
user = "xenia";
hostname = "192.168.1.166";
forwardAgent = true;
};
};
}

30
home/ssh/work.nix Normal file
View file

@ -0,0 +1,30 @@
{ pkgs, lib, ... }:
{
imports = [ ./common.nix ];
home.packages = with pkgs; [ sshfs ];
programs.ssh.matchBlocks = {
"batch" = {
user = "cxsbatch";
hostname = "heimdall115.jetdata.eu";
};
"jupyter" = {
hostname = "freia022.hpc.l";
localForwards = [
{
bind.port = 6702;
host.address = "localhost";
host.port = 6702;
}
];
};
"freia" = {
hostname = "freia022.hpc.l";
};
"freia???" = lib.hm.dag.entryAfter [ "freia" ] {
hostname = "%h.hpc.l";
};
"freia* jupyter" = lib.hm.dag.entryAfter [ "freia" "freia???" "jupyter" ] {
user = "elitherl";
};
};
}

View file

@ -1,2 +0,0 @@
Host git.ccfe.ac.uk
user git

View file

@ -1,14 +0,0 @@
# vim: ft=sshconfig
Host batch
User cxsbatch
HostName heimdall115.jetdata.eu
Host freia
HostName freia022.hpc.l
LocalForward 6702 localhost:6702
Host freia???
HostName %h.hpc.l
Host freia*
User elitherl

View file

@ -1,7 +0,0 @@
# vim: ft=sshconfig
Host legion xenia xenia.me.uk
User xenia
HostName xenia.me.uk
Port 30
ForwardAgent yes