From 5002cf9d4851f1e5bcadca0ce61945c53d7d10f9 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Fri, 5 May 2023 13:20:32 +0100 Subject: [PATCH] Move SSH configs into specific collections --- home/collections/personal/default.nix | 13 ++++++++++ home/collections/work/default.nix | 27 ++++++++++++++++++- home/env/ssh.nix | 37 ++------------------------- 3 files changed, 41 insertions(+), 36 deletions(-) diff --git a/home/collections/personal/default.nix b/home/collections/personal/default.nix index 1d94f482..d7811cf1 100644 --- a/home/collections/personal/default.nix +++ b/home/collections/personal/default.nix @@ -4,6 +4,19 @@ ../common/desktop.nix ../../git/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; [ discord element-desktop diff --git a/home/collections/work/default.nix b/home/collections/work/default.nix index 68d7b09f..ff64a9fc 100644 --- a/home/collections/work/default.nix +++ b/home/collections/work/default.nix @@ -1,9 +1,34 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: { imports = [ ../common/desktop.nix ../../git/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; [ libreoffice-fresh neovide diff --git a/home/env/ssh.nix b/home/env/ssh.nix index 0274c5dd..ecce075d 100644 --- a/home/env/ssh.nix +++ b/home/env/ssh.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ pkgs, ... }: { programs.ssh = { enable = true; @@ -7,40 +7,7 @@ serverAliveCountMax = 3; controlMaster = "auto"; controlPersist = "1s"; - 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; - }; - "git.ccfe.ac.uk".user = "git"; - "batch" = { - user = "cxsbatch"; - hostname = "heimdall115.jetdata.eu"; - }; - "freia" = { - hostname = "freia022.hpc.l"; - remoteForwards = [ - { - bind.port = 6702; - host.address = "localhost"; - host.port = 6702; - } - ]; - }; - "freia???" = lib.hm.dag.entryAfter ["freia"] { - hostname = "%h.hpc.l"; - }; - "freia*" = lib.hm.dag.entryAfter ["freia???"] { - user = "elitherl"; - }; - }; + matchBlocks."git.*".user = "git"; }; home.packages = with pkgs; [ sshfs ]; }