From 549ab36c30b9dc3c0827f63500abb497f110da20 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 2 Aug 2026 13:38:03 +0200 Subject: [PATCH] docs: add NixOS integration section Just a very basic example of how to use the NixOS module that Nixpkgs provides. --- docs/integrations/nixos.rst | 33 +++++++++++++++++++++++++++++++++ docs/postgrest.dict | 1 + 2 files changed, 34 insertions(+) create mode 100644 docs/integrations/nixos.rst diff --git a/docs/integrations/nixos.rst b/docs/integrations/nixos.rst new file mode 100644 index 000000000..e35f573bd --- /dev/null +++ b/docs/integrations/nixos.rst @@ -0,0 +1,33 @@ +NixOS +===== + +Nixpkgs contains a `NixOS module to run PostgREST `_, 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. diff --git a/docs/postgrest.dict b/docs/postgrest.dict index 8eabc855c..f8120a407 100644 --- a/docs/postgrest.dict +++ b/docs/postgrest.dict @@ -97,6 +97,7 @@ namespaced Nanos neq nginx +NixOS nixpkgs npm nxl