112 lines
3.4 KiB
Nix
112 lines
3.4 KiB
Nix
{ ... }:
|
|
{
|
|
disko.devices = {
|
|
disk = {
|
|
# Devices will be mounted and formatted in alphabetical order, and btrfs can only mount raids
|
|
# when all devices are present. So we define an "empty" luks device on the first disk,
|
|
# and the actual btrfs raid on the second disk, and the name of these entries matters!
|
|
system = {
|
|
type = "disk";
|
|
device = "/dev/sdb";
|
|
content = {
|
|
type = "gpt";
|
|
partitions = {
|
|
boot = {
|
|
name = "boot";
|
|
size = "1M";
|
|
type = "EF02";
|
|
};
|
|
ESP = {
|
|
size = "512M";
|
|
type = "EF00";
|
|
content = {
|
|
type = "filesystem";
|
|
format = "vfat";
|
|
mountpoint = "/boot";
|
|
mountOptions = [ "umask=0077" ];
|
|
};
|
|
};
|
|
crypt_root = {
|
|
size = "100%";
|
|
content = {
|
|
type = "luks";
|
|
name = "p_root";
|
|
settings = {
|
|
allowDiscards = true;
|
|
keyFile = "/dev/disk/by-uuid/2021-07-11-12-33-27-00";
|
|
keyFileSize = 4096;
|
|
};
|
|
content = {
|
|
type = "btrfs";
|
|
subvolumes = {
|
|
"/root" = {
|
|
mountpoint = "/";
|
|
};
|
|
"/nix" = {
|
|
mountpoint = "/nix";
|
|
mountOptions = [ "compress=zstd:3" ];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
data = {
|
|
type = "disk";
|
|
device = "/dev/sda";
|
|
content = {
|
|
type = "gpt";
|
|
partitions = {
|
|
crypt_p = {
|
|
size = "100%";
|
|
content = {
|
|
type = "luks";
|
|
name = "p_data";
|
|
# Remove settings.keyFile if you want to use interactive password entry
|
|
settings = {
|
|
allowDiscards = true;
|
|
keyFile = "/dev/disk/by-uuid/2021-07-11-12-33-27-00"; # Same key for both devices
|
|
keyFileSize = 4096;
|
|
};
|
|
content = {
|
|
type = "btrfs";
|
|
subvolumes = {
|
|
"/" = {
|
|
mountpoint = "/mnt/fs";
|
|
mountOptions = [ "compress=zstd:3" ];
|
|
};
|
|
|
|
"/data" = {
|
|
mountpoint = "/mnt/data";
|
|
mountOptions = [ "compress=zstd:3" ];
|
|
};
|
|
"/mediacenter" = {
|
|
mountpoint = "/mnt/mediacenter";
|
|
mountOptions = [ "compress=zstd:3" ];
|
|
};
|
|
"/backups" = {
|
|
mountpoint = "/mnt/backups";
|
|
mountOptions = [ "compress=zstd:6" ];
|
|
};
|
|
"/jellyfin" = {
|
|
mountpoint = "/mnt/jellyfin";
|
|
mountOptions = [ ];
|
|
};
|
|
"/containers" = {
|
|
mountpoint = "/var/lib/containers";
|
|
mountOptions = [ ];
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|