nix-config/hosts/hyp-01/modules/disko.nix
Lander Van den Bulcke a55ed8b41b
feat: add hyp-01
Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
2025-11-01 18:23:04 +01:00

115 lines
2.6 KiB
Nix

let
disk1 = "/dev/disk/by-path/pci-0000:00:17.0-ata-2.0";
disk2 = "/dev/disk/by-path/pci-0000:00:17.0-ata-3.0";
in
{
disko.devices = {
disk = {
disk1 = {
type = "disk";
device = disk1;
content = {
type = "table";
format = "mbr";
partitions = [
{
name = "boot-primary";
size = "1G";
bootable = true;
type = "EF02";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "nofail" ];
};
}
{
name = "zfs-a";
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
}
];
};
};
disk2 = {
type = "disk";
device = disk2;
content = {
type = "table";
format = "mbr";
partitions = [
{
name = "boot-secondary";
size = "1G";
bootable = true;
type = "EF02";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot-fallback";
mountOptions = [ "nofail" ];
};
}
{
name = "zfs-b";
size = "100%";
content = {
type = "zfs";
pool = "zroot";
};
}
];
};
};
};
zpool = {
zroot = {
type = "zpool";
mode = "mirror";
rootFsOptions = {
compression = "lz4";
acltype = "posixacl";
xattr = "sa";
"com.sun:auto-snapshot" = "true";
mountpoint = "none";
};
options.ashift = "12";
datasets = {
"root" = {
type = "zfs_fs";
options = {
mountpoint = "none";
encryption = "aes-256-gcm";
keyformat = "passphrase";
keylocation = "prompt";
};
};
"root/nix" = {
type = "zfs_fs";
mountpoint = "/nix";
options.atime = "off";
};
"root/persist" = {
type = "zfs_fs";
mountpoint = "/persist";
};
};
};
};
};
boot.loader.grub = {
device = disk1;
mirroredBoots = [
{
devices = [ disk2 ];
path = "/boot-fallback";
}
];
};
}