Services
processes are a low-level interface to starting a tool, while services provide a higher level configuration.
Here's an example starting PostgreSQL with a few extensions:
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;";
};
}
Services start like processes with devenv up
:
Service states are persisted to directories in $DEVENV_STATE
. When you adjust options like the above used initialScript
, you will have to delete the service's directory for changes to take effect on next devenv up
.
Services in the background
Services start in the foreground by default. If you want to start services up in the background, you can pass the -d
flag:
Supported services
services.adminer.enable = true;
services.blackfire.enable = true;
services.caddy.enable = true;
services.cassandra.enable = true;
services.clickhouse.enable = true;
services.cockroachdb.enable = true;
services.couchdb.enable = true;
services.dynamodb-local.enable = true;
services.elasticmq.enable = true;
services.elasticsearch.enable = true;
services.httpbin.enable = true;
services.influxdb.enable = true;
services.kafka.enable = true;
services.mailhog.enable = true;
services.mailpit.enable = true;
services.meilisearch.enable = true;
services.memcached.enable = true;
services.minio.enable = true;
services.mongodb.enable = true;
services.mysql.enable = true;
services.nginx.enable = true;
services.opensearch.enable = true;
services.opentelemetry-collector.enable = true;
services.postgres.enable = true;
services.rabbitmq.enable = true;
services.redis.enable = true;
services.sqld.enable = true;
services.temporal.enable = true;
services.tideways.enable = true;
services.trafficserver.enable = true;
services.typesense.enable = true;
services.varnish.enable = true;
services.vault.enable = true;
services.wiremock.enable = true;
You can find all supported options for services here.