Files
infra/machines/sirius/disko.nix
2026-02-13 11:02:06 +07:00

112 lines
2.6 KiB
Nix

{ lib, ... }:
let
hashDisk = disk: "os-${builtins.substring 0 5 (builtins.hashString "sha256" disk)}";
os = "/dev/disk/by-id/mmc-SD64G_0x8336354b";
vdev = [
"/dev/disk/by-id/ata-ST20000NM002H-3KV133_ZYDBVV7Z"
"/dev/disk/by-id/ata-ST20000NM002H-3KV133_ZYDBSJRE"
];
in
{
boot.loader = {
systemd-boot = {
enable = true;
};
efi = {
canTouchEfiVariables = true;
};
tmp.useTmpfs = true;
};
disko.devices = {
disk = {
"os-${hashDisk os}" = {
type = "disk";
device = os;
content = {
type = "gpt";
partitions = {
ESP = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"umask=0077"
"nofail"
];
};
};
root = {
name = "root";
size = "100%";
content = {
type = "filesystem";
format = "f2fs";
mountpoint = "/";
extraArgs = [
"-0"
"extra_attr,inode_checksum,sb_checksum,compression"
];
mountOptions = "compress_algorithm=zstd:6,compress_chksum,atgc,gc_merge,lazytime,nodiscard";
};
};
};
};
};
}
// (lib.listToAttrs (
map (disk: {
name = "data-${hashDisk disk}";
value = {
type = "disk";
device = disk;
content = {
type = "zfs";
pool = "zdata";
};
};
}) vdev
));
zpool = {
zdata = {
type = "zpool";
options.ashift = "12";
rootFsOptions = {
mountpoint = "none";
compression = "lz4";
acltype = "posixacl";
xattr = "sa";
"com.sun:auto-snapshot" = "true";
};
mode = {
topology = {
type = "topology";
vdev = [
{
mode = "mirror";
members = vdev;
}
];
};
};
datasets = {
"nas" = {
type = "zfs_fs";
mountpoint = "/mnt/hdd";
mountOptions = [ "nofail" ];
};
"service-data" = {
type = "zfs_fs";
mountpoint = "/var/lib";
mountOptions = [ "nofail" ];
};
};
};
};
};
}