2024-07-12 07:40:25 +02:00
|
|
|
{
|
|
|
|
# https://github.com/nix-community/disko/blob/master/example/boot-raid1.nix
|
|
|
|
imports = [ ../../common/services/snapper.nix ];
|
|
|
|
|
|
|
|
# extra configs not present in the standard config above
|
|
|
|
services.snapper.configs.Storage = {
|
|
|
|
TIMELINE_CREATE = true;
|
|
|
|
TIMELINE_CLEANUP = true;
|
|
|
|
SUBVOLUME = "/Storage";
|
|
|
|
};
|
|
|
|
|
|
|
|
services.btrfs.autoScrub.enable = true;
|
|
|
|
services.btrfs.autoScrub.interval = "weekly";
|
|
|
|
|
2024-07-13 05:50:16 +02:00
|
|
|
disko.devices = {
|
|
|
|
disk = {
|
2024-07-14 05:15:14 +02:00
|
|
|
sda = {
|
2024-07-13 05:50:16 +02:00
|
|
|
type = "disk";
|
2024-07-14 05:15:14 +02:00
|
|
|
device = "/dev/sda";
|
2024-07-13 05:50:16 +02:00
|
|
|
content = {
|
|
|
|
type = "gpt";
|
|
|
|
partitions = {
|
|
|
|
BOOT = {
|
|
|
|
size = "1M";
|
|
|
|
type = "EF02"; # GRUB MBR
|
|
|
|
};
|
|
|
|
ESP = {
|
|
|
|
size = "500M";
|
|
|
|
type = "EF00";
|
|
|
|
content = {
|
|
|
|
type = "mdraid";
|
|
|
|
name = "boot";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
mdadm = {
|
|
|
|
size = "100%";
|
|
|
|
content = {
|
|
|
|
type = "mdraid";
|
|
|
|
name = "raid1";
|
|
|
|
};
|
2024-07-12 07:40:25 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-07-14 05:15:14 +02:00
|
|
|
sdb = {
|
2024-07-13 05:50:16 +02:00
|
|
|
type = "disk";
|
2024-07-14 05:15:14 +02:00
|
|
|
device = "/dev/sdb";
|
2024-07-13 05:50:16 +02:00
|
|
|
content = {
|
|
|
|
type = "gpt";
|
|
|
|
partitions = {
|
|
|
|
BOOT = {
|
|
|
|
size = "1M";
|
|
|
|
type = "EF02"; # GRUB MBR
|
|
|
|
};
|
|
|
|
ESP = {
|
|
|
|
size = "500M";
|
|
|
|
type = "EF00";
|
|
|
|
content = {
|
|
|
|
type = "mdraid";
|
|
|
|
name = "boot";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
mdadm = {
|
|
|
|
size = "100%";
|
|
|
|
content = {
|
|
|
|
type = "mdraid";
|
|
|
|
name = "raid1";
|
|
|
|
};
|
2024-07-12 07:40:25 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-07-13 05:50:16 +02:00
|
|
|
|
|
|
|
mdadm = {
|
|
|
|
boot = {
|
|
|
|
type = "mdadm";
|
|
|
|
level = 1;
|
|
|
|
metadata = "1.0";
|
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
|
|
|
format = "vfat";
|
|
|
|
mountpoint = "/boot";
|
|
|
|
mountOptions = [ "umask=0077" ];
|
|
|
|
};
|
2024-07-12 07:40:25 +02:00
|
|
|
};
|
2024-07-13 05:50:16 +02:00
|
|
|
raid1 = {
|
|
|
|
type = "mdadm";
|
|
|
|
level = 1;
|
|
|
|
content = {
|
|
|
|
type = "gpt";
|
|
|
|
partitions = {
|
|
|
|
LUKS-ROOT = {
|
|
|
|
start = "550MiB";
|
|
|
|
end = "100%";
|
2024-07-12 07:40:25 +02:00
|
|
|
content = {
|
2024-07-13 05:50:16 +02:00
|
|
|
type = "luks";
|
|
|
|
name = "ROOT";
|
|
|
|
extraOpenArgs = [ "--allow-discards" ];
|
|
|
|
content = {
|
|
|
|
type = "btrfs";
|
|
|
|
extraArgs = [ "-f" ];
|
|
|
|
subvolumes = {
|
|
|
|
"/root" = {
|
|
|
|
mountpoint = "/";
|
|
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
|
|
}; # root
|
|
|
|
"/home" = {
|
|
|
|
mountpoint = "/home";
|
|
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
|
|
}; # home
|
|
|
|
"/nix" = {
|
|
|
|
mountpoint = "/nix";
|
|
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
|
|
}; # nix
|
|
|
|
"/Storage" = {
|
|
|
|
mountpoint = "/Storage";
|
|
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
|
|
}; # Storage
|
|
|
|
# SNAPSHOT SUBVOLS
|
|
|
|
"/root/.snapshots" = {
|
|
|
|
mountpoint = "/.snapshots";
|
|
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
|
|
}; # root
|
|
|
|
"/home/.snapshots" = {
|
|
|
|
mountpoint = "/home/.snapshots";
|
|
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
|
|
}; # home
|
|
|
|
"/nix/.snapshots" = {
|
|
|
|
mountpoint = "/nix/.snapshots";
|
|
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
|
|
}; # nix
|
|
|
|
"/Storage/.snapshots" = {
|
|
|
|
mountpoint = "/Storage/.snapshots";
|
|
|
|
mountOptions = [ "compress=zstd" "noatime" ];
|
|
|
|
}; # Storage
|
|
|
|
}; # subvolumes
|
|
|
|
}; # content.content
|
|
|
|
}; # content
|
|
|
|
}; # partition 2 (/ BTRFS)
|
|
|
|
};
|
2024-07-12 07:40:25 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-07-13 05:50:16 +02:00
|
|
|
};
|
2024-07-12 14:05:02 +02:00
|
|
|
}
|