docs: add NixOS integration section

Just a very basic example of how to use the NixOS module that Nixpkgs
provides.
This commit is contained in:
Wolfgang Walther
2026-08-02 14:51:50 +00:00
parent 42754cb6c9
commit 549ab36c30
2 changed files with 34 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
NixOS
=====
Nixpkgs contains a `NixOS module to run PostgREST <https://search.nixos.org/options?channel=unstable&query=services.postgrest&type=options>`_, which can be enabled with ``services.postgrest.enable = true``.
A PostgreSQL server can be enabled on the same machine with ``services.postgresql.enable = true``. Connections will use the name of the system user as user and database names by default, in this case ``postgrest``.
A minimal example could look like this:
.. code-block:: nix
{
pkgs,
...
}:
{
services.postgresql = {
enable = true;
initialScript = pkgs.writeText "init.sql" ''
CREATE ROLE postgrest LOGIN NOINHERIT;
CREATE ROLE anon ROLE postgrest;
'';
};
services.postgrest = {
enable = true;
settings.db-anon-role = "anon";
settings.db-uri.dbname = "postgres";
};
}
This will expose the PostgREST server on localhost on the NixOS machine and allow anonymous access.
+1
View File
@@ -97,6 +97,7 @@ namespaced
Nanos
neq
nginx
NixOS
nixpkgs
npm
nxl