{ pkgs, lib, config, ... }:
let
  cfg = config.mods.server.atuin;
  port = config.mods.server.nginx.ports.atuin;
in with lib; {
  options.mods.server = {
    atuin = {
      enable = mkEnableOption {
        default = false;
        description = "enables atuin server";
      };
    };
  };

  config = mkIf cfg.enable {
    services.atuin = {
      inherit port;
      enable = true;
      host = "0.0.0.0";
      openRegistration = true;
    };
  };
}

