Skip to content

nats

Whether to enable the NATS messaging server.

NATS is a simple, secure and high performance messaging system for cloud native applications, IoT messaging, and microservices architectures.

Type: boolean

Default:

false

Declared by:

Which NATS server package to use.

Type: package

Default:

pkgs.nats-server

Declared by:

Whether to enable authorization for client connections.

Type: boolean

Default:

false

Example:

true

Declared by:

Password required for client connections. Only used if authorization is enabled. Warning: This will be visible in the Nix store.

Type: string

Default:

""

Example:

"nats-pass"

Declared by:

Token required for client connections. Alternative to user/password authentication. Warning: This will be visible in the Nix store.

Type: string

Default:

""

Example:

"my-secret-token"

Declared by:

Username required for client connections. Only used if authorization is enabled.

Type: string

Default:

""

Example:

"nats-user"

Declared by:

Client URL to advertise to other servers in a cluster. Useful when running behind NAT or in containers.

Type: string

Default:

""

Example:

"localhost:4222"

Declared by:

Enable debug logging for troubleshooting.

Type: boolean

Default:

false

Declared by:

Network host to listen on for client connections. Set to “0.0.0.0” to listen on all interfaces. Default is localhost for security.

Type: string

Default:

"127.0.0.1"

Example:

"0.0.0.0"

Declared by:

Whether to enable JetStream persistence layer for streaming and queues.

Type: boolean

Default:

false

Example:

true

Declared by:

Maximum disk space for file-based streams. Use suffixes: K, M, G, T for sizes.

Type: string

Default:

"10G"

Example:

"100G"

Declared by:

Maximum memory for in-memory streams. Use suffixes: K, M, G, T for sizes.

Type: string

Default:

"1G"

Example:

"512M"

Declared by:

Path to log file. If empty, logs to stdout. Stdout is recommended for devenv as logs are captured by process manager.

Type: string

Default:

""

Example:

"/var/log/nats-server.log"

Declared by:

Enable HTTP monitoring endpoint. Provides /healthz, /varz, /connz, and other monitoring endpoints. Highly recommended for production deployments.

Type: boolean

Default:

true

Declared by:

Port for HTTP monitoring endpoint. Access monitoring at http://host:port/varz

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

8222

Declared by:

Port to listen on for client connections.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

4222

Declared by:

Server name for identification in clusters. If empty, NATS will auto-generate a unique name.

Type: string

Default:

""

Example:

"nats-dev-1"

Declared by:

Additional NATS server configuration as a Nix attribute set. This will be converted to NATS config file format.

Use this for advanced features like:

  • TLS/SSL configuration
  • Clustering with routes
  • MQTT gateway
  • WebSocket support
  • Custom authorization

See https://docs.nats.io/running-a-nats-service/configuration

Type: attribute set

Default:

{ }

Example:

{
tls = {
cert_file = "/path/to/cert.pem";
key_file = "/path/to/key.pem";
verify = true;
};
cluster = {
name = "my-cluster";
listen = "0.0.0.0:6222";
routes = [
"nats://node1:6222"
"nats://node2:6222"
];
};
}

Declared by:

Enable protocol tracing for deep debugging. Warning: Very verbose output.

Type: boolean

Default:

false

Declared by: