nix/hosts/liminal/disko.nix
2025-12-29 13:00:41 -08:00

88 lines
2.4 KiB
Nix

# Config for framework 16
# sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount disko.nix
{
disko.devices = {
disk = {
nvme0n1 = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
label = "boot";
name = "ESP";
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" "defaults" ];
};
};
swap = {
size = "70G";
type = "8200";
content = {
type = "swap";
resumeDevice = true;
};
};
cryptroot = {
size = "100%";
content = {
type = "luks";
name = "cryptroot";
passwordFile = "/tmp/secret.key";
settings = {
allowDiscards = true;
crypttabExtraOpts = [ "no-read-workqueue" "no-write-workqueue" ];
};
content = {
type = "btrfs";
extraArgs = [ "-L" "nixos" "-f" ];
subvolumes = {
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" "noatime" "ssd" "space_cache=v2" ];
};
"/home" = {
mountpoint = "/home";
mountOptions = [ "compress=zstd" "noatime" "ssd" "space_cache=v2" ];
};
"/var/log" = {
mountpoint = "/var/log";
mountOptions = [ "compress=zstd" "noatime" "ssd" "space_cache=v2" ];
};
"/var/lib" = {
mountpoint = "/var/lib";
mountOptions = [ "compress=zstd" "noatime" "ssd" "space_cache=v2" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" "ssd" "space_cache=v2" ];
};
};
};
};
};
};
};
};
};
nodev = {
"/" = {
fsType = "tmpfs";
mountOptions = [
"defaults"
"size=4G"
"mode=755"
];
};
};
};
filesystems."/persist".neededForBoot = true;
filesystems."/var/log".neededForBoot = true;
}