summaryrefslogtreecommitdiff
path: root/system-profiles/initrd-ssh/default.nix
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2026-11-25 09:48:16 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2026-11-25 09:48:16 +0100
commit0de15ae2403694b02de584ed5eee38d7c6e27b8b (patch)
tree98ec7efab3cfcb248a3808310f1a91edc4a0861f /system-profiles/initrd-ssh/default.nix
parent2f83beb1ff4a0d9b4a731930a129866bd5e5d933 (diff)
downloadnixos-0de15ae2403694b02de584ed5eee38d7c6e27b8b.tar
nixos-0de15ae2403694b02de584ed5eee38d7c6e27b8b.tar.gz
nixos-0de15ae2403694b02de584ed5eee38d7c6e27b8b.tar.bz2
nixos-0de15ae2403694b02de584ed5eee38d7c6e27b8b.tar.xz
nixos-0de15ae2403694b02de584ed5eee38d7c6e27b8b.zip
Diffstat (limited to 'system-profiles/initrd-ssh/default.nix')
-rw-r--r--system-profiles/initrd-ssh/default.nix47
1 files changed, 0 insertions, 47 deletions
diff --git a/system-profiles/initrd-ssh/default.nix b/system-profiles/initrd-ssh/default.nix
deleted file mode 100644
index ef469343..00000000
--- a/system-profiles/initrd-ssh/default.nix
+++ /dev/null
@@ -1,47 +0,0 @@
1{ hostName, config, pkgs, lib, ... }:
2
3with lib;
4
5{
6 config = {
7 boot.initrd = {
8 network = {
9 enable = true;
10 ssh = {
11 enable = true;
12 hostKeys = [ "/etc/ssh/ssh_host_ed25519_key" "/etc/ssh/ssh_host_rsa_key" ];
13 authorizedKeys = config.users.users.root.openssh.authorizedKeys.keys ++ map (kF: builtins.readFile kF) config.users.users.root.openssh.authorizedKeys.keyFiles;
14
15 extraConfig = ''
16 ForceCommand cryptsetup-askpass
17 '';
18 };
19 };
20
21 secrets = with config.sops.secrets; {
22 "/etc/ssh/ssh_host_ed25519_key" = mkForce initrd_ssh_host_ed25519_key.path;
23 "/etc/ssh/ssh_host_rsa_key" = mkForce initrd_ssh_host_rsa_key.path;
24 };
25
26 extraFiles = let
27 mkPubkey = typ: pkgs.runCommand "ssh_host_${typ}_key.pub" { buildInputs = with pkgs; [ yq ]; } ''
28 yq -r '.${typ}' ${./host-keys + "/${hostName}-public.yaml"} > $out
29 '';
30 in {
31 "/etc/ssh/ssh_host_rsa_key.pub".source = mkPubkey "rsa";
32 "/etc/ssh/ssh_host_ed25519_key.pub".source = mkPubkey "ed25519";
33 };
34 };
35
36 sops.secrets = {
37 initrd_ssh_host_rsa_key = {
38 key = "rsa";
39 sopsFile = ./host-keys + "/${hostName}-private.yaml";
40 };
41 initrd_ssh_host_ed25519_key = {
42 key = "ed25519";
43 sopsFile = ./host-keys + "/${hostName}-private.yaml";
44 };
45 };
46 };
47}