This commit is contained in:
server 2024-10-16 18:06:17 +00:00
parent e5980dca43
commit c173ba1404
2 changed files with 13 additions and 11 deletions

View file

@ -18,30 +18,32 @@
system.stateVersion = "24.05"; system.stateVersion = "24.05";
# FDE stuff # FDE stuff
networking.firewall.allowedTCPPorts = [ 2222 ];
systemd.services.sshd.wantedBy = [ "cryptsetup.target" ];
networking.useDHCP = true;
boot.initrd = { boot.initrd = {
availableKernelModules = [ "virtio-pci" ]; availableKernelModules = [ "virtio-pci" ];
secrets = {"/root/initrd-ssh-key" = "/root/initrd-ssh-key";}; secrets = {"/root/initrd-ssh-key" = "/root/initrd-ssh-key";};
network = { network = {
udhcpc.enable = true; #udhcpc.enable = true;
flushBeforeStage2 = true; #flushBeforeStage2 = true;
enable = true; enable = true;
ssh = { ssh = {
enable = true; enable = true;
port = 2222; port = 2222;
hostKeys = [ /boot/initrd/ssh_host_rsa_key ]; hostKeys = [ /root/initrd-ssh-key ];
# this includes the ssh keys of all users in the wheel group, but you can just specify some keys manually # this includes the ssh keys of all users in the wheel group, but you can just specify some keys manually
# authorizedKeys = [ "ssh-rsa ..." ]; # authorizedKeys = [ "ssh-rsa ..." ];
authorizedKeys = with lib; concatLists (mapAttrsToList (name: user: if elem "wheel" user.extraGroups then user.openssh.authorizedKeys.keys else []) config.users.users); authorizedKeys = with lib; concatLists (mapAttrsToList (name: user: if elem "wheel" user.extraGroups then user.openssh.authorizedKeys.keys else []) config.users.users);
}; };
postCommands = '' #postCommands = ''
echo 'cryptsetup-askpass' >> /root/.profile # echo 'cryptsetup-askpass' >> /root/.profile
''; #'';
};
}; };
}
} }

View file

@ -14,7 +14,7 @@
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
boot.initrd.systemd.enable = true; boot.initrd.systemd.enable = true;
#boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/db8a5cf9-c54b-4e6a-b3f9-e6323eb962a6"; boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/db8a5cf9-c54b-4e6a-b3f9-e6323eb962a6";
fileSystems."/" = fileSystems."/" =
{ device = "/dev/disk/by-uuid/4f7afb2d-a730-4a0c-a9e4-92d75ebd1540"; { device = "/dev/disk/by-uuid/4f7afb2d-a730-4a0c-a9e4-92d75ebd1540";
@ -40,4 +40,4 @@
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }