quickdb is a suite of Nix packages to easily start development instances of PostgreSQL, MariaDB, or CouchDB on GNU Linux.
- No root needed - You need the Nix package manager to use
quickdb, but if you don't already have it you can use the portable version Nix portable. - No additional dependencies - You don't need anything other than the Nix package manager.
- Configured for development - The database is automatically configured to only listen on localhost, and (except for couchdb) you can just log right in without credentials.
- Multi-instance - You can easily set up multiple instances of a given database; Just edit the config files to use different ports.
- Runs like a normal process - Stdout goes to the console, and a simple CTRL-C stops the database. No weird daemons to deal with.
- Multiple database major versions available - Using Nixpkgs snapshots as needed, this repo provides easy access to PostgreSQL 17, 18..., MariaDB 11.4, 11.8...
Note: In the demo I used localhost when connecting with psql. It's also possible to use a socket directory, which is the run directory within the database directory. ex psql -h $PWD/testdb/run DBNAME. However, psql doesn't seem to like relative paths, hence the $PWD.
- Development - I developed
quickdbin order to quickly and easily set up a database when I need it without having to have the database running 24/7. You can start a database the moment you need it, and shut it down the moment you're done. No root. Nosudo. - Staging/testing - When your done with the database, just delete the directory.
- Database migration tests - Want to see what happens when upgrading PostgreSQL from 17 to 18? Just make a copy your database directory, and run it with the new version. No sudo needed.
To get a list of the available packages, run nix flake show github:emmanuelrosa/quickdb
Each package has three modes of operation:
- Initialization - When executed with a path to a non-existent directory, the directory is created and the database system is initialized within the directory. After initialization, the database system can be configured by editing one or more configuration files.
- Execution - When executed with a path to an existent directory, it is assumed a database has been initialized within the directory, so the database is started in the foreground. This means standard output is printed to the screen, and a simple CTRL-C is all that's needed to stop the database.
- Shell - When executed without any arguments, a BASH shell is started with the database client tools in the PATH.
- To create a PostgreSQL database, execute:
nix run github:emmanuelrosa/quickdb#quickdb-postgresql-17 -- ~/my-postgresql - To configure the database, edit the
*.conffiles in~/my-postgresql. - To run the database, execute the same command:
nix run github:emmanuelrosa/quickdb#quickdb-postgresql-17 -- ~/my-postgresql - To access the postgresql client tools, using another terminal execute
nix run github:emmanuelrosa/quickdb#quickdb-postgresql-17 - To stop postgresql, press CTRL-C.
- To create a MariaDB database, execute:
nix run github:emmanuelrosa/quickdb#quickdb-mariadb-114 -- ~/my-mariadb - To configure the database, edit
~/my-mariadb/etc/my.cnf. - To run the database, execute the same command:
nix run github:emmanuelrosa/quickdb#quickdb-mariadb-114 -- ~/my-mariadb - To access the mariadb client tools, using another terminal execute
nix run github:emmanuelrosa/quickdb#quickdb-mariadb-114. Before using the mariadb client, set the envirionment variableMYSQL_UNIX_PORTto the path to the socket file; ex.export MYSQL_UNIX_PORT=~/my-mariadb/run/mariadb.sock - To stop mariadb, press CTRL-C.
- To create a CouchDB database, execute:
nix run github:emmanuelrosa/quickdb#quickdb-couchdb-3 -- ~/my-couchdb - To configure the database, edit
~/my-couchdb/etc/local.iniand~/my-couchdb/etc/epmd.env. The default user name is admin and the password is password. - To run the database, execute the same command:
nix run github:emmanuelrosa/quickdb#quickdb-couchdb-3 -- ~/my-couchdb - To use
curlandjqwith couchdb, from another terminal executenix run github:emmanuelrosa/quickdb#quickdb-couchdb-3 - To stop couchdb, press CTRL-C.