baremetal: enable initrd ssh by default, fix bootstrapping

This commit is contained in:
Sandro - 2024-01-07 03:41:31 +01:00
parent 2b8571c784
commit 4002f3802a
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
1 changed files with 3 additions and 3 deletions

View File

@ -18,8 +18,7 @@
initrd.network = {
enable = true;
ssh = {
# TODO: enable now per machine
# enable = true;
enable = true;
authorizedKeys = config.users.users.root.openssh.authorizedKeys.keys;
hostKeys = [
initrdEd2219Key
@ -58,9 +57,10 @@
smartd.enable = true;
};
# this needs to be unconditional because the keys need to be inplace when activating the feature
system.activationScripts.generateInitrdOpensshHostKeys = let
sshKeygen = "${config.programs.ssh.package}/bin/ssh-keygen";
in lib.mkIf config.boot.initrd.network.ssh.enable ''
in ''
if [[ ! -e ${initrdEd2219Key} || ! -e ${initrdRsaKey} ]]; then
echo "Generating initrd OpenSSH hostkeys..."
mkdir -m700 -p /etc/ssh/initrd/