surgat: add sshd to initrd
This commit is contained in:
parent
f252b99469
commit
9c27dbc6c3
5 changed files with 38 additions and 1 deletions
34
nixos/modules/profiles/cloud.nix
Normal file
34
nixos/modules/profiles/cloud.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
secretsPath = config.dadada.secrets.path;
|
||||
initrdHostKey = "${config.networking.hostName}-ssh_host_ed25519_key";
|
||||
in
|
||||
{
|
||||
boot.initrd.availableKernelModules = [ "virtio-pci" ];
|
||||
boot.initrd.network = {
|
||||
enable = true;
|
||||
ssh = {
|
||||
enable = true;
|
||||
port = 43235;
|
||||
hostKeys = [
|
||||
age.secrets."${initrdHostKey}"
|
||||
];
|
||||
authorizedKeys = with lib;
|
||||
concatLists (mapAttrsToList
|
||||
(name: user:
|
||||
if elem "wheel" user.extraGroups then
|
||||
user.openssh.authorizedKeys.keys
|
||||
else
|
||||
[ ])
|
||||
config.users.users);
|
||||
};
|
||||
postCommands = ''
|
||||
echo 'cryptsetup-askpass' >> /root/.profile
|
||||
'';
|
||||
};
|
||||
|
||||
age.secrets."${initrdHostKey}" = {
|
||||
file = "${secretsPath}/${initrdHostKey}";
|
||||
mode = "600";
|
||||
};
|
||||
}
|
|
@ -26,7 +26,7 @@ with lib; {
|
|||
system.autoUpgrade = {
|
||||
enable = true;
|
||||
flake = "github:dadada/nix-config#${config.networking.hostName}";
|
||||
allowReboot = true;
|
||||
allowReboot = mkDefault true;
|
||||
randomizedDelaySec = "45min";
|
||||
};
|
||||
|
||||
|
|
|
@ -113,5 +113,7 @@ in
|
|||
];
|
||||
};
|
||||
|
||||
system.autoUpgrade.allowReboot = false;
|
||||
|
||||
system.stateVersion = "20.09";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue