factorize os configurations

This commit is contained in:
ant 2025-09-01 22:37:33 +02:00
parent 8de0ba7158
commit fe967e50cb
7 changed files with 134 additions and 155 deletions

27
os/remote-disk-unlock.nix Normal file
View file

@ -0,0 +1,27 @@
sshKeys: ({ config, pkgs, ... }: {
boot.kernelParams = [ "ip=dhcp" ];
boot = {
initrd = {
availableKernelModules = [ "r8169" "igb" ];
network = {
enable = true;
udhcpc = {
enable = true;
extraArgs = [ "--background" "--retries" "1" ];
};
flushBeforeStage2 = true;
ssh = {
enable = true;
port = 22;
authorizedKeys = sshKeys;
hostKeys = [ "/etc/ssh/ssh_host_ed25519_key" ];
# shell = "/bin/cryptsetup-askpass";
};
postCommands = ''
# Automatically ask for the password on SSH login
echo 'cryptsetup-askpass || echo "Unlock was successful; exiting SSH session" && exit 1' >> /root/.profile
'';
};
};
};
})