From fe91044c8b9a223cb860d78682efdd9739288bb3 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 7 Jul 2025 17:47:51 +0800 Subject: [PATCH] refactor(nixos): move persisted ssh host keys to ssh module --- nix/modules/machine/root/ephemeral.nix | 7 ------- nix/modules/ssh.nix | 10 ++++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 nix/modules/ssh.nix diff --git a/nix/modules/machine/root/ephemeral.nix b/nix/modules/machine/root/ephemeral.nix index 729f1cc..0b9657f 100644 --- a/nix/modules/machine/root/ephemeral.nix +++ b/nix/modules/machine/root/ephemeral.nix @@ -17,13 +17,6 @@ in btrfs subvolume delete "/btrfs_tmp/root" fi ''; - persistFiles = [ - #TODO: move to ssh config - "/etc/ssh/ssh_host_ed25519_key" - "/etc/ssh/ssh_host_ed25519_key.pub" - "/etc/ssh/ssh_host_rsa_key" - "/etc/ssh/ssh_host_rsa_key.pub" - ]; }) ]; }; diff --git a/nix/modules/ssh.nix b/nix/modules/ssh.nix new file mode 100644 index 0000000..4c8fde2 --- /dev/null +++ b/nix/modules/ssh.nix @@ -0,0 +1,10 @@ +{ + flake.modules.nixos.default = { + persistFiles = [ + "/etc/ssh/ssh_host_ed25519_key" + "/etc/ssh/ssh_host_ed25519_key.pub" + "/etc/ssh/ssh_host_rsa_key" + "/etc/ssh/ssh_host_rsa_key.pub" + ]; + }; +}