{
  lib,
  pkgs,
  config,
  ...
}:
with lib;
{
  options = {
    kanboard = {
      enable = mkEnableOption "enables kanboard";
      port = lib.mkOption {
        type = lib.types.int;
        default = 3128;
        description = "The port kanboard listens on.";
      };
      host = mkOption {
        type = types.str;
        defaultText = literalExpression "127.0.0.1";
        description = "The hostname that kanboard binds to";
      };
      domain = mkOption {
        type = types.str;
        defaultText = literalExpression "home.wastring.com";
        description = "The hostname that kanboard binds to";
      };
    };
  };
  config = mkMerge [
    (mkIf config.kanboard.enable {
      services.kanboard = {
        enable = true;
		domain = config.kanboard.domain;
		nginx = null;
      };
      services.nginx.virtualHosts.${config.kanboard.domain} = {
        forceSSL = true;
        enableACME = true;
        locations."/" = {
          proxyPass = "http://${toString config.kanboard.host}:${toString config.kanboard.port}";
          proxyWebsockets = true;
        };
      };
    })
  ];

}
