ctucx.git: nixfiles

ctucx' nixfiles

commit c85f91b4062003bd9ac9d4d7d75f260f63325b64
parent 3f22d7d6be069b3f395f93bd211c7c1c3630a01b
Author: Leah (ctucx) <leah@ctu.cx>
Date: Tue, 13 Sep 2022 21:51:59 +0200

machines/hector: add luks-unlock in initramfs
1 file changed, 25 insertions(+), 5 deletions(-)
M
machines/hector/configuration.nix
|
30
+++++++++++++++++++++++++-----
diff --git a/machines/hector/configuration.nix b/machines/hector/configuration.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
 
 {
 

@@ -13,10 +13,30 @@
     ../../configurations/services/restic-server.nix
   ];
 
-  boot.loader.grub = {
-    enable  = true;
-    version = 2;
-    device  = "/dev/sda";
+  boot = {
+    loader.grub = {
+      enable  = true;
+      version = 2;
+      device  = "/dev/sda";
+    };
+
+    initrd.network = {
+      enable = true;
+      ssh    = {
+        enable         = true;
+        port           = 22;
+        hostKeys       = [ /etc/ssh/ssh_host_rsa_key ];
+        authorizedKeys = with lib; concatLists (mapAttrsToList (name: user: if elem "wheel" user.extraGroups then user.openssh.authorizedKeys.keys else []) config.users.users);
+      };
+
+      postCommands = ''
+        ip link set dev ens18 up
+        ip addr add 2a01:4f9:6b:2d99:2829:acab::1 dev ens18
+        ip route add default via 2a01:4f9:6b:2d99::2 dev ens18 onlink
+
+        echo 'cryptsetup-askpass' >> /root/.profile
+      '';
+    };
   };
 
   dns.zones."ctu.cx".subdomains.hector.AAAA = [ "2a01:4f9:6b:2d99:2829:acab::1" ];