tvl-depot/users/sterni/machines/ingeborg/hardware.nix
sterni 825b6ac65f feat(sterni/machines/ingeborg): boot-strap
Network configuration and initrd setup is basically the same as with
edwin, but we are using md for Software RAID this time as well as LVM
over two partitions with LUKS:

- sda2 <-- RAID1 --> sdb2 (boot-raid)
  └ boot partition, ext4 (encrypted-container-raid)
- sda3 <-- RAID1 --> sdb3
  └ LUKS container
    └ Volume Group vgmain
      ├ Logical Volume vgmain/swap
      │ └ swap
      └ Logical Volume vgmain/root
        └ btrfs

So we no longer rely on btrfs raid1 due to question marks over its
reliability (I personally did not have any problems though). This also
means that we have less LUKS containers we need to unlock when
booting (kind of neglible improvement). The biggest improvement is that
we have redundancy for the swap, so a disk failure shouldn't cause
memory corruption/loss.

Change-Id: I14f065b659857415917d9a60a7ec019e687f8d1c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10127
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <tazjin@tvl.su>
Reviewed-by: sterni <sternenseemann@systemli.org>
2023-11-25 22:55:32 +00:00

76 lines
1.5 KiB
Nix

{ config, lib, pkgs, depot, ... }:
{
# Booting / Kernel
boot = {
loader.grub = {
enable = true;
devices = [
"/dev/disk/by-id/wwn-0x5000c500a4859731"
"/dev/disk/by-id/wwn-0x5000c500a485c1b5"
];
};
initrd = {
availableKernelModules = [
"ahci"
"btrfs"
"sd_mod"
"xhci_pci"
"e1000e"
];
kernelModules = [
"dm-snapshot"
];
};
swraid = {
enable = true;
mdadmConf = ''
ARRAY /dev/md/boot-raid metadata=1.2 name=nixos:boot-raid UUID=13007b9d:ab7a1129:c45ec40f:3c9f2111
ARRAY /dev/md/encrypted-container-raid metadata=1.2 name=nixos:encrypted-container-raid UUID=38dfa683:a6d30690:32a5de6f:fb7980fe
'';
};
kernelModules = [
"kvm-intel"
];
};
# Filesystems
services.lvm.enable = true;
boot.initrd.luks.devices."container" = {
device = "/dev/md/encrypted-container-raid";
preLVM = true;
};
fileSystems = {
"/" = {
device = "/dev/mainvg/root";
fsType = "btrfs";
};
"/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "ext4";
};
};
swapDevices = [
{ device = "/dev/mainvg/swap"; }
];
# CPU
hardware = {
cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
enableRedistributableFirmware = true;
};
nix.settings = {
max-jobs = 2;
cores = 4;
};
powerManagement.cpuFreqGovernor = "performance";
}