73 lines
1.9 KiB
Nix
73 lines
1.9 KiB
Nix
|
{
|
||
|
disko.devices = {
|
||
|
disk =
|
||
|
let
|
||
|
# This is a general setup which will be replicated on both disks ...
|
||
|
# even the boot partition, just the mountpoint is different which will
|
||
|
# be set in the nixos configuration
|
||
|
diskLayout =
|
||
|
{ bootName }:
|
||
|
{
|
||
|
type = "gpt";
|
||
|
partitions = {
|
||
|
boot = {
|
||
|
size = "1M";
|
||
|
type = "EF02";
|
||
|
};
|
||
|
# efi? idk, experiment if this is really needed
|
||
|
ESP = {
|
||
|
size = "500M";
|
||
|
type = "EF00";
|
||
|
content = {
|
||
|
type = "filesystem";
|
||
|
format = "vfat";
|
||
|
mountpoint = "/${bootName}";
|
||
|
mountOptions = [ "umask=0077" ];
|
||
|
};
|
||
|
};
|
||
|
zfs = {
|
||
|
size = "100%";
|
||
|
content = {
|
||
|
type = "zfs";
|
||
|
pool = "zraid";
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
in
|
||
|
{
|
||
|
one = {
|
||
|
type = "disk";
|
||
|
device = "/dev/nvme0n1";
|
||
|
content = diskLayout { bootName = "boot"; };
|
||
|
};
|
||
|
two = {
|
||
|
type = "disk";
|
||
|
device = "/dev/nvme1n1";
|
||
|
content = diskLayout { bootName = "boot-fallback"; };
|
||
|
};
|
||
|
};
|
||
|
zpool = {
|
||
|
zraid = {
|
||
|
type = "zpool";
|
||
|
mode = "mirror";
|
||
|
# Workaround: cannot import 'zraid': I/O error in disko tests
|
||
|
options.cachefile = "none";
|
||
|
rootFsOptions = {
|
||
|
compression = "zstd";
|
||
|
"com.sun:auto-snapshot" = "true";
|
||
|
};
|
||
|
mountpoint = "/";
|
||
|
postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zraid@blank$' || zfs snapshot zraid@blank";
|
||
|
|
||
|
datasets = {
|
||
|
zfs_fs = {
|
||
|
type = "zfs_fs";
|
||
|
mountpoint = "/zfs_fs";
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|