{
  lib,
  config,
  ...
}:
let
  inherit (lib)
    mkEnableOption
    mkOption
    types
    ;
in
{
  options.machine.forgejo = {
    enable = mkEnableOption "Forgejo";
    enableRunner = mkEnableOption "Actions runner";
    domain = mkOption {
      type = types.nullOr types.str;
      default = null;
      description = "Domain name. If not set, will be disabled, and use the localhost.";
    };
    port = mkOption {
      type = types.port;
      default = 3000;
      description = "Listen port.";
    };
    database = {
      host = mkOption {
        type = types.str;
        default = "127.0.0.1";
        description = "PostgreSQL database host address.";
      };
      port = mkOption {
        type = types.port;
        default = config.services.postgresql.port;
        description = "PostgreSQL database host port.";
      };
    };
  };
}
