{ lib, namespace, ... }:
with lib;
let
  inherit (lib.${namespace}) mkOpt mkBoolOpt;
in
{
  options.${namespace}.hardware.disko = {
    enable = mkEnableOption "enable disko";
    filesystem = mkOption {
      type = types.enum [
        "bcachefs"
        "btrfs"
      ];
      default = "btrfs";
      description = "Filesystem to use for the root partition";
    };

    enableSwap = mkBoolOpt false "Enable swap";

    enableLuks = mkBoolOpt false "Enable Luks";

    enableFirmware = mkBoolOpt false "Enable rpi firmware part";

    swapSize = mkOpt types.str "16G" "size of swap part";

    rootDisk = mkOpt types.str "/dev/nvme0n1" "Root disk";

    compression = mkOpt types.str "zstd" "Type of compression to enable";

    subvolumes =
      mkOpt
        (types.attrsOf (
          types.submodule {
            options = {
              mountPoint = mkOpt (types.nullOr types.path) null "Mountpoint of the subvolume";
              mountOptions = mkOpt (types.nullOr (types.listOf types.str)) null "Extra mount options";
            };
          }
        ))
        {
          "home" = { };
          "etc" = { };
          "nix" = { };
          "root" = { };
          "log" = {
            mountPoint = "/var/log";
          };
        }
        "Subvolumes on root disk";
  };
}
