NixOS Module

简体中文

The flake exports nixosModules.default and nixosModules.codex-quota-monitor.

Minimal Example

{
  inputs.codexQuotaMonitor.url = "github:<owner>/codex-quota-monitor";

  outputs = inputs@{ self, nixpkgs, codexQuotaMonitor, ... }: {
    nixosConfigurations.my-host = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        codexQuotaMonitor.nixosModules.default
        ({ ... }: {
          services.codexQuotaMonitor = {
            enable = true;
            installCli = true;
            managementBaseUrl = "http://127.0.0.1:8317";
            managementKeyFile = "/path/to/management-key";
            gatewayHealthUrl = "http://127.0.0.1:8317/healthz";
            authDir = "/path/to/auth-files";
            # Optional and disabled by default. This writes live_plan_* metadata
            # back to CPA auth files for routers that consume fresh plan state.
            # authLivePlanSync.enable = true;
          };
        })
      ];
    };
  };
}

Key Options

Defaults

Browser-local preferences in the dashboard override these service defaults for the current browser only. Locale, timezone, and font preferences are separate: locale controls UI language and browser-side date/number formatting, timezone controls reset-time display, and fonts only select CSS font-family stacks. The project does not bundle fonts; a named font is used only when the device rendering the page already has it installed.

If you want LAN access from a phone or small-screen browser, set listenAddress = "0.0.0.0", add the browser-facing hostname or IP to allowedHosts, and set openFirewall = true intentionally. That only makes the dashboard reachable and allows the expected Host / Origin; it does not authenticate viewers. Protect LAN or public access with firewall rules and an authenticated reverse proxy or access layer.