Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/cachix/devenv/llms.txt

Use this file to discover all available pages before exploring further.

devenv services are pre-configured integrations for popular software like databases, message brokers, and web servers. Instead of managing Docker containers or manual installations, you declare the services you need in devenv.nix and start them all with a single command. State is stored locally in .devenv/state/, so each project keeps its data completely isolated.

Starting Services

Services are a higher-level abstraction over devenv processes. Enable a service in devenv.nix, then run devenv up to start all configured services:
$ devenv up
Starting processes ...
Services run in the foreground by default. To start them in the background, pass the -d flag:
$ devenv up -d
Service state is persisted to directories under $DEVENV_STATE (i.e. .devenv/state/). If you change options like initialScript, delete the service’s state directory and re-run devenv up for the changes to take effect.

PostgreSQL

PostgreSQL is one of the most commonly used services in devenv. The module supports version selection, extensions, initial databases, and full postgresql.conf configuration.

Basic setup

devenv.nix
{ pkgs, ... }:

{
  services.postgres.enable = true;
}
By default, a database named after the current user is created automatically.

With extensions and initial data

devenv.nix
{ pkgs, ... }:

{
  services.postgres = {
    enable = true;
    package = pkgs.postgresql_15;
    initialDatabases = [{ name = "mydb"; }];
    extensions = extensions: [
      extensions.postgis
      extensions.timescaledb
    ];
    settings.shared_preload_libraries = "timescaledb";
    initialScript = "CREATE EXTENSION IF NOT EXISTS timescaledb;";
  };
}

Key PostgreSQL options

OptionDefaultDescription
packagepkgs.postgresqlPostgreSQL version to use (e.g. pkgs.postgresql_15)
port5432TCP port to listen on
listen_addresses"" (unix socket only)IP address(es) to bind — set "127.0.0.1" for TCP
initialDatabases[]Databases to create on first startup
initialScriptnullSQL to run server-wide after initialization
extensionsnullExtra PostgreSQL extensions to install
settings{}postgresql.conf key/value settings
createDatabasetrueCreate a database named after $USER if initialDatabases is empty

Creating databases with schemas

{
  services.postgres = {
    enable = true;
    initialDatabases = [
      {
        name = "foodatabase";
        schema = ./foodatabase.sql;
      }
      { name = "bardatabase"; }
    ];
  };
}

Enabling TCP connections

By default, PostgreSQL only listens on a Unix socket. To allow TCP connections (e.g. from a GUI client):
{
  services.postgres = {
    enable = true;
    listen_addresses = "127.0.0.1";
  };
}

Redis

The Redis module starts a Redis server and exposes redis-cli and related utilities in your shell.

Basic setup

devenv.nix
{ pkgs, ... }:

{
  services.redis.enable = true;
}

Configuration options

OptionDefaultDescription
packagepkgs.redisRedis package to use
port6379TCP port. Set to 0 to use a Unix socket only
bind"127.0.0.1"IP interface to bind. null = all interfaces
extraConfig"locale-collate C"Additional lines appended to redis.conf

Custom configuration

devenv.nix
{ pkgs, ... }:

{
  services.redis = {
    enable = true;
    port = 6380;
    extraConfig = ''
      locale-collate C
      maxmemory 256mb
      maxmemory-policy allkeys-lru
    '';
  };
}

Unix socket mode

Set port = 0 to disable TCP and use a Unix socket instead. The socket path is available via $REDIS_UNIX_SOCKET:
{
  services.redis = {
    enable = true;
    port = 0;
  };
}

All Available Services

devenv includes modules for the following services:

Databases

  • postgres — PostgreSQL
  • mysql — MySQL / MariaDB
  • mongodb — MongoDB
  • couchdb — CouchDB
  • cassandra — Apache Cassandra
  • cockroachdb — CockroachDB
  • clickhouse — ClickHouse
  • influxdb — InfluxDB
  • dynamodb-local — DynamoDB Local
  • sqld — sqld (libSQL server)

Caching & Search

  • redis — Redis
  • memcached — Memcached
  • elasticsearch — Elasticsearch
  • opensearch — OpenSearch
  • meilisearch — Meilisearch
  • typesense — Typesense

Messaging & Streaming

  • kafka — Apache Kafka
  • rabbitmq — RabbitMQ
  • nats — NATS
  • mosquitto — Mosquitto (MQTT)
  • elasticmq — ElasticMQ (SQS-compatible)

Object Storage

  • minio — MinIO
  • garage — Garage
  • rustfs — RustFS

Web & Proxy

  • nginx — nginx
  • caddy — Caddy
  • varnish — Varnish
  • trafficserver — Apache Traffic Server
  • wiremock — WireMock
  • httpbin — httpbin

Observability & Auth

  • prometheus — Prometheus
  • opentelemetry-collector — OpenTelemetry Collector
  • keycloak — Keycloak
  • vault — HashiCorp Vault
  • tailscale — Tailscale
  • blackfire — Blackfire
  • tideways — Tideways
  • nixseparatedebuginfod — nix-separate-debuginfod

Mail

  • mailhog — MailHog
  • mailpit — Mailpit

Workflow & Admin

  • temporal — Temporal
  • adminer — Adminer

Build docs developers (and LLMs) love