- Add @persist subvolume to BTRFS layout - Implement automatic root-blank snapshotting during installation - Add initrd rollback script to wipe root on every boot - Configure persistence for core system state (NM, Bluetooth, SSH, NixOS config)
68 lines
2.1 KiB
Nix
68 lines
2.1 KiB
Nix
{
|
|
disko.devices = {
|
|
disk = {
|
|
main = {
|
|
type = "disk";
|
|
device = "@TARGET_DRIVE@";
|
|
content = {
|
|
type = "gpt";
|
|
partitions = {
|
|
ESP = {
|
|
priority = 1;
|
|
name = "ESP";
|
|
start = "1M";
|
|
end = "512M";
|
|
type = "EF00";
|
|
content = {
|
|
type = "filesystem";
|
|
format = "vfat";
|
|
mountpoint = "/boot";
|
|
mountOptions = [ "umask=0077" ];
|
|
};
|
|
};
|
|
luks = {
|
|
size = "100%";
|
|
content = {
|
|
type = "luks";
|
|
name = "crypted";
|
|
settings.allowDiscards = true;
|
|
content = {
|
|
type = "btrfs";
|
|
extraArgs = [ "-f" ];
|
|
subvolumes = {
|
|
"@" = {
|
|
mountpoint = "/";
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
};
|
|
"@persist" = {
|
|
mountpoint = "/persist";
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
};
|
|
"@home" = {
|
|
mountpoint = "/home";
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
};
|
|
"@nix" = {
|
|
mountpoint = "/nix";
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
};
|
|
"@log" = {
|
|
mountpoint = "/var/log";
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
};
|
|
};
|
|
postCreateHook = ''
|
|
MNTPOINT=$(mktemp -d)
|
|
mount -t btrfs /dev/mapper/crypted $MNTPOINT
|
|
btrfs subvolume snapshot -r $MNTPOINT/@ $MNTPOINT/root-blank
|
|
umount $MNTPOINT
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
} |