Files
nixos-configs/hosts/orpheus/hardware-configuration.nix
2025-12-31 15:48:38 +01:00

95 lines
1.7 KiB
Nix

{inputs, lib, ... }: {
imports = [
inputs.disko.nixosModules.disko
../common/optional/ephemeral-btrfs.nix
];
boot = {
initrd = {
availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usb_storage"
"usbhid"
"sd_mod"
];
kernelModules = ["kvm-amd"];
};
loader = {
systemd-boot = {
enable = true;
consoleMode = "max";
};
efi.canTouchEfiVariables = true;
};
};
disko.devices.disk.main = {
device = "/dev/nvme0n1";
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02";
};
esp = {
name = "ESP";
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
luks = {
size = "100%";
content = {
name = "root";
type = "luks";
settings.allowDiscards = true;
content = {
type = "btrfs";
postCreateHook = ''
MNTPOINT=$(mktemp -d)
mount -t btrfs "$device" "$MNTPOINT"
trap 'umount $MNTPOINT; rm -d $MNTPOINT' EXIT
btrfs subvolume snapshot -r $MNTPOINT/root $MNTPOINT/root-blank
'';
subvolumes = {
"/root" = {
mountOptions = ["compress=zstd"];
mountpoint = "/";
};
"/nix" = {
mountOptions = ["compress=zstd" "noatime"];
mountpoint = "/nix";
};
"/persist" = {
mountOptions = ["compress=zstd"];
mountpoint = "/persist";
};
"/swap" = {
mountOptions = ["compress=zstd" "noatime"];
mountpoint = "/swap";
swap.swapfile = {
size = "60G";
path = "swapfile";
};
};
};
};
};
};
};
};
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}