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 = "gpt";
          efiGptPartitionFirst = false;
          partitions = {
            boot = {
              priority = 1;
              type = "EF02";
              size = "32M";
              content = {
                type = "filesystem";
                format = "vfat";
                mountpoint = null;
              };
              hybrid = {
                mbrPartitionType = "0x0c";
                mbrBootableFlag = false;
              };
            };
            esp = {
              size = "1G";
              type = "EF00";
              content = {
                type = "filesystem";
                format = "vfat";
                mountpoint = "/boot";
                mountOptions = [ "nofail" ];
              };
            };
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "zroot";
              };
            };
          };
        };
      };
      disk2 = {
        type = "disk";
        device = disk2;
        content = {
          type = "gpt";
          efiGptPartitionFirst = false;
          partitions = {
            boot = {
              priority = 1;
              type = "EF02";
              size = "32M";
              content = {
                type = "filesystem";
                format = "vfat";
                mountpoint = null;
              };
              hybrid = {
                mbrPartitionType = "0x0c";
                mbrBootableFlag = false;
              };
            };
            esp = {
              size = "1G";
              type = "EF00";
              content = {
                type = "filesystem";
                format = "vfat";
                mountpoint = "/boot-fallback";
                mountOptions = [ "nofail" ];
              };
            };
            zfs = {
              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;
    version = 2;
    zfsSupport = true;
    efiSupport = true;
    mirroredBoots = [
      {
        devices = [ disk1 ];
        path = "/boot";
      }
      {
        devices = [ disk2 ];
        path = "/boot-fallback";
      }
    ];
  };
}
