This commit is contained in:
Andrea Ciceri 2024-02-11 14:10:04 +01:00
parent cb0a071ee6
commit 7f3441fc76
Signed by: aciceri
SSH key fingerprint: SHA256:/AagBweyV4Hlfg9u092n8hbHwD5fcB6A3qhDiDA65Rg
4 changed files with 54 additions and 13 deletions

View file

@ -1,24 +1,38 @@
{config, ...}: {
{
config,
pkgs,
...
}: {
# For unlocking the disk connect using ssh and type
# systemctl start initrd-nixos-activation
boot.initrd = {
network = {
enable = true;
ssh = {
enable = true;
ignoreEmptyHostKeys = true;
extraConfig = ''
HostKey /ssh_initrd_host_ed25519_key
'';
authorizedKeys = with (import ../../lib).keys.users; [
ccr-gpg
ccr-ssh
];
};
};
systemd = {
enable = true;
storePaths = ["${config.programs.ssh.package}/bin/ssh-keygen"];
network.enable = true;
storePaths = [
"${config.programs.ssh.package}/bin/ssh-keygen"
"${pkgs.bashInteractive}/bin/bash"
];
services.sshd.preStart = ''
${config.programs.ssh.package}/bin/ssh-keygen -t ed25519 -N "" -f /ssh_initrd_host_ed25519_key
[ ! -f /ssh_initrd_host_ed25519_key ] && ${config.programs.ssh.package}/bin/ssh-keygen -t ed25519 -N "" -f /ssh_initrd_host_ed25519_key
chmod 600 /ssh_initrd_host_ed25519_key
'';
};
};
boot.initrd.systemd.additionalUpstreamUnits = ["debug-shell.service"];
boot.kernelParams = ["rd.systemd.debug_shell"];
}