add fulldiskencryption

This commit is contained in:
Dennis Wuitz 2023-12-25 04:27:28 +01:00
parent e08f011d28
commit 666367bb4d
2 changed files with 29 additions and 1 deletions

View File

@ -13,19 +13,45 @@ in
default = ""; default = "";
description = "The cpu-type installed on the server."; description = "The cpu-type installed on the server.";
}; };
amdGPU = libS.mkOpinionatedOption "the system contains a AMD GPU";
}; };
}; };
config.boot = lib.mkIf cfg.default { config.boot = lib.mkIf cfg.default {
initrd = {
# networking for netcard kernelModules = [ "e1000e" ];
kernelModules = lib.mkIf cfg.amdGPU [ "amdgpu" ];
network.enable = true;
network.ssh = {
enable = true;
hostKeys = [
"/root/ssh_key"
];
port = 2222;
};
luks = {
devices."cryptroot" = {
device = "/dev/sda1";
preLVM = true;
};
};
};
supportedFilesystems = [ "zfs" ]; supportedFilesystems = [ "zfs" ];
tmp.useTmpfs = true; tmp.useTmpfs = true;
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
kernelParams = [ "nordrand" ] ++ lib.optional (cfg.cpuType == "amd") "kvm-amd"; kernelParams = [
"ip=<ip-addr>::<ip-gateway>:<netmask>"
"nordrand"
] ++ lib.optional (cfg.cpuType == "amd") "kvm-amd";
zfs = { zfs = {
enableUnstable = true; enableUnstable = true;
devNodes = "/dev/disk/by-id/"; devNodes = "/dev/disk/by-id/";
forceImportRoot = true; forceImportRoot = true;
}; };
loader = { loader = {
efi = { efi = {
canTouchEfiVariables = false; canTouchEfiVariables = false;
@ -39,6 +65,7 @@ in
efiInstallAsRemovable = true; efiInstallAsRemovable = true;
fsIdentifier = "uuid"; fsIdentifier = "uuid";
device = "nodev"; device = "nodev";
enableCryptodisk = true;
}; };
}; };
}; };

View File

@ -3,6 +3,7 @@
time.timeZone = "America/New_York"; time.timeZone = "America/New_York";
console.keyMap = "us"; console.keyMap = "us";
networking.hostId = "1139fa08"; networking.hostId = "1139fa08";
boot.initrd.network.ssh.authorizedKeys = [ "ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" ];
virtualisation = { virtualisation = {
docker = { docker = {