docs: update docs for postgresql plugins (#64899)

docs: update docs for postgresql plugins

Co-Authored-By: Mario Rodas <marsam@users.noreply.github.com>
This commit is contained in:
Danylo Hlynskyi 2019-07-21 22:05:41 +03:00 committed by GitHub
parent b647c76929
commit caa0f82bf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 80 additions and 33 deletions

View file

@ -6,26 +6,10 @@ let
cfg = config.services.postgresql;
# see description of extraPlugins
postgresqlAndPlugins = pg:
if cfg.extraPlugins == [] then pg
else pkgs.buildEnv {
name = "postgresql-and-plugins-${(builtins.parseDrvName pg.name).version}";
paths = [ pg pg.lib ] ++ cfg.extraPlugins;
# We include /bin to ensure the $out/bin directory is created which is
# needed because we'll be removing files from that directory in postBuild
# below. See #22653
pathsToLink = [ "/" "/bin" ];
buildInputs = [ pkgs.makeWrapper ];
postBuild =
''
rm $out/bin/{pg_config,postgres,pg_ctl}
cp --target-directory=$out/bin ${pg}/bin/{postgres,pg_config,pg_ctl}
wrapProgram $out/bin/postgres --set NIX_PGLIBDIR $out/lib
'';
};
postgresql = postgresqlAndPlugins cfg.package;
postgresql =
if cfg.extraPlugins == []
then cfg.package
else cfg.package.withPackages (_: cfg.extraPlugins);
# The main PostgreSQL configuration file.
configFile = pkgs.writeText "postgresql.conf"
@ -58,7 +42,7 @@ in
package = mkOption {
type = types.package;
example = literalExample "pkgs.postgresql_9_6";
example = literalExample "pkgs.postgresql_11";
description = ''
PostgreSQL package to use.
'';
@ -74,7 +58,7 @@ in
dataDir = mkOption {
type = types.path;
example = "/var/lib/postgresql/9.6";
example = "/var/lib/postgresql/11";
description = ''
Data directory for PostgreSQL.
'';
@ -195,17 +179,11 @@ in
extraPlugins = mkOption {
type = types.listOf types.path;
default = [];
example = literalExample "[ (pkgs.postgis.override { postgresql = pkgs.postgresql_9_4; }) ]";
example = literalExample "with pkgs.postgresql_11.pkgs; [ postgis pg_repack ]";
description = ''
When this list contains elements a new store path is created.
PostgreSQL and the elements are symlinked into it. Then pg_config,
postgres and pg_ctl are copied to make them use the new
$out/lib directory as pkglibdir. This makes it possible to use postgis
without patching the .sql files which reference $libdir/postgis-1.5.
List of PostgreSQL plugins. PostgreSQL version for each plugin should
match version for <literal>services.postgresql.package</literal> value.
'';
# Note: the duplication of executables is about 4MB size.
# So a nicer solution was patching postgresql to allow setting the
# libdir explicitely.
};
extraConfig = mkOption {