From 7277ebc2f9d25d6f90fcd52687bfadeca5201051 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Tue, 25 Mar 2025 15:00:50 +0100 Subject: [PATCH] Reapply "nixos/postgresql: add docs about procedural languages" This reverts commit a4006e4970b3476eb02c5ce36343d144da4fe34b. --- nixos/doc/manual/redirects.json | 3 ++ .../modules/services/databases/postgresql.md | 31 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/nixos/doc/manual/redirects.json b/nixos/doc/manual/redirects.json index 29f7f9d51996..11c6c5813114 100644 --- a/nixos/doc/manual/redirects.json +++ b/nixos/doc/manual/redirects.json @@ -1253,6 +1253,9 @@ "module-services-postgres-plugins": [ "index.html#module-services-postgres-plugins" ], + "module-services-postgres-pls": [ + "index.html#module-services-postgres-pls" + ], "module-services-postgres-jit": [ "index.html#module-services-postgres-jit" ], diff --git a/nixos/modules/services/databases/postgresql.md b/nixos/modules/services/databases/postgresql.md index f92e0fd19d02..737b97f02bbb 100644 --- a/nixos/modules/services/databases/postgresql.md +++ b/nixos/modules/services/databases/postgresql.md @@ -328,6 +328,37 @@ self: super: { } ``` +## Procedural Languages {#module-services-postgres-pls} + +PostgreSQL ships the additional procedural languages PL/Perl, PL/Python and PL/Tcl as extensions. +They are packaged as plugins and can be made available in the same way as external extensions: +```nix +{ + services.postgresql.extensions = ps: with ps; [ + plperl + plpython3 + pltcl + ]; +} +``` + +Each procedural language plugin provides a `.withPackages` helper to make language specific packages available at run-time. + +For example, to make `python3Packages.base58` available: +```nix +{ + services.postgresql.extensions = pgps: with pgps; [ + (plpython3.withPackages (pyps: with pyps; [ base58 ])) + ]; +} +``` + +This currently works for: +- `plperl` by re-using `perl.withPackages` +- `plpython3` by re-using `python3.withPackages` +- `plr` by exposing `rPackages` +- `pltcl` by exposing `tclPackages` + ## JIT (Just-In-Time compilation) {#module-services-postgres-jit} [JIT](https://www.postgresql.org/docs/current/jit-reason.html)-support in the PostgreSQL package