From 2f096d99359fbeccbb4487c0ccf7848e5ad89076 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Sun, 27 Jul 2025 18:18:02 +0200 Subject: [PATCH] Add SSH configuration management via nix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create modules/ssh.nix with all host configurations - Import SSH module in flake.nix homeConfiguration - Manage SSH config declaratively through home-manager 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- flake.nix | 1 + modules/ssh.nix | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 modules/ssh.nix diff --git a/flake.nix b/flake.nix index 130c413..6f927eb 100644 --- a/flake.nix +++ b/flake.nix @@ -43,6 +43,7 @@ ./modules/nvim.nix ./modules/tmux.nix ./modules/zsh.nix + ./modules/ssh.nix ]; home.username = "yanlin"; diff --git a/modules/ssh.nix b/modules/ssh.nix new file mode 100644 index 0000000..1926d63 --- /dev/null +++ b/modules/ssh.nix @@ -0,0 +1,60 @@ +{ config, pkgs, ... }: + +{ + programs.ssh = { + enable = true; + + matchBlocks = { + "aicloud" = { + hostname = "aicloud"; + user = "hb05nk@cs.aau.dk"; + identityFile = "~/.ssh/keys/aicloud"; + proxyJump = "pi"; + }; + + "nas" = { + hostname = "nas.hw.yanlincs.com"; + user = "root"; + identityFile = "~/.ssh/keys/nas"; + }; + + "pi" = { + hostname = "pi.hw.yanlincs.com"; + user = "yanlin"; + identityFile = "~/.ssh/keys/pi"; + }; + + "cm" = { + hostname = "cm.hw.yanlincs.com"; + user = "yanlin"; + identityFile = "~/.ssh/keys/pi"; + }; + + "personal-vps" = { + hostname = "personal.vps.yanlincs.com"; + user = "root"; + identityFile = "~/.ssh/keys/hetzner"; + }; + + "zero" = { + hostname = "zero.hw.yanlincs.com"; + user = "yanlin"; + identityFile = "~/.ssh/keys/pi"; + }; + + "ucloud-a40" = { + hostname = "130.225.38.194"; + user = "ucloud"; + identityFile = "~/.ssh/keys/ucloud"; + proxyJump = "imac"; + }; + + "ucloud-h100" = { + hostname = "ssh.cloud.sdu.dk"; + user = "ucloud"; + port = 2281; + identityFile = "~/.ssh/keys/ucloud"; + }; + }; + }; +} \ No newline at end of file