Newer
Older
skyworks-Nix-infra / hosts / skydick / disko.nix
# Disko: System disk partitioning for skydick
# Primary: Samsung SSD 860 EVO 250GB (wwn-0x5002538e4099ad35)
# Future: Add second disk to mirror rpool
{ ... }:

{
  disko.devices = {
    disk.system = {
      device = "/dev/disk/by-id/wwn-0x5002538e4099ad35";
      type = "disk";
      content = {
        type = "gpt";
        partitions = {
          esp = {
            size = "2G";
            type = "EF00";
            content = {
              type = "filesystem";
              format = "vfat";
              mountpoint = "/boot";
              mountOptions = [ "defaults" "umask=0077" ];
            };
          };
          swap = {
            size = "32G";
            content = {
              type = "swap";
              randomEncryption = true;
            };
          };
          root = {
            size = "100%";
            content = {
              type = "zfs";
              pool = "rpool";
            };
          };
        };
      };
    };

    zpool.rpool = {
      type = "zpool";
      options = {
        ashift = "12";
        autotrim = "on";
        failmode = "continue";
      };
      rootFsOptions = {
        compression = "lz4";
        atime = "off";
        xattr = "sa";
        acltype = "posixacl";
        dnodesize = "auto";
        normalization = "formD";
        mountpoint = "none";
        canmount = "off";
      };
      datasets = {
        "nixos" = {
          type = "zfs_fs";
          options = {
            mountpoint = "none";
            canmount = "off";
          };
        };
        "nixos/root" = {
          type = "zfs_fs";
          mountpoint = "/";
          options = {
            canmount = "on";
            "com.sun:auto-snapshot" = "true";
          };
        };
        "nixos/nix" = {
          type = "zfs_fs";
          mountpoint = "/nix";
          options = {
            canmount = "on";
            atime = "off";
            "com.sun:auto-snapshot" = "false";
          };
        };
        "nixos/var" = {
          type = "zfs_fs";
          mountpoint = "/var";
          options = {
            canmount = "on";
            "com.sun:auto-snapshot" = "true";
          };
        };
        "nixos/var/log" = {
          type = "zfs_fs";
          mountpoint = "/var/log";
          options = {
            canmount = "on";
            compression = "zstd";
            "com.sun:auto-snapshot" = "false";
          };
        };
        "nixos/home" = {
          type = "zfs_fs";
          mountpoint = "/home";
          options = {
            canmount = "on";
            "com.sun:auto-snapshot" = "true";
          };
        };
      };
    };
  };
}