94 lines
1.7 KiB
Nix
94 lines
1.7 KiB
Nix
|
|
{inputs, ... }: {
|
|
imports = [
|
|
inputs.disko.nixosModules.disko
|
|
../common/optional/ephermal-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";
|
|
partions = {
|
|
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";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|
|
|
|
|