aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2018-09-14 21:44:08 +0200
committerJulien Lepiller <julien@lepiller.eu>2018-10-04 22:30:23 +0200
commit0d57a50af28056cbe4a3c215e1a3cc95d88bba1c (patch)
tree815f601ce5ab9448dd63e91f8dbd4e619c108f38 /doc
parentc336567dad48c5cdae0b442b58fae70a83b03e9b (diff)
downloadpatches-0d57a50af28056cbe4a3c215e1a3cc95d88bba1c.tar
patches-0d57a50af28056cbe4a3c215e1a3cc95d88bba1c.tar.gz
gnu: postgresql: Add extension-packages.
* gnu/services/databases.scm (postgresql-configuration): Add extension-packages. (postgresql-shepherd-service): New key #:extension-packages. * doc/guix.texi (Database Services): Document it.
Diffstat (limited to 'doc')
-rw-r--r--doc/guix.texi38
1 files changed, 37 insertions, 1 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index d2d278df47..b5c2d4d954 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -13383,13 +13383,49 @@ The @code{(gnu services databases)} module provides the following services.
@deffn {Scheme Procedure} postgresql-service [#:postgresql postgresql] @
[#:config-file] [#:data-directory ``/var/lib/postgresql/data''] @
- [#:port 5432] [#:locale ``en_US.utf8'']
+ [#:port 5432] [#:locale ``en_US.utf8''] [#:extension-packages '()]
Return a service that runs @var{postgresql}, the PostgreSQL database
server.
The PostgreSQL daemon loads its runtime configuration from @var{config-file},
creates a database cluster with @var{locale} as the default
locale, stored in @var{data-directory}. It then listens on @var{port}.
+
+@cindex postgresql extension-packages
+Additional extensions are loaded from packages listed in
+@var{extension-packages}. Extensions are available at runtime. For instance,
+to create a geographic database using the @code{postgis} extension, a user can
+configure the postgresql-service as in this example:
+
+@cindex postgis
+@example
+(use-package-modules databases geo)
+
+(operating-system
+ ...
+ ;; postgresql is required to run `psql' but postgis is not required for
+ ;; proper operation.
+ (packages (cons* postgresql %base-packages))
+ (services
+ (cons*
+ (postgresql-service #:extension-packages (list postgis))
+ %base-services)))
+@end example
+
+Then the extension becomes visible and you can initialise an empty geographic
+database in this way:
+
+@example
+psql -U postgres
+> create database postgistest;
+> \connect postgistest;
+> create extension postgis;
+> create extension postgis_topology;
+@end example
+
+There is no need to add this field for contrib extensions such as hstore or
+dblink as they are already loadable by postgresql. This field is only
+required to add extensions provided by other packages.
@end deffn
@deffn {Scheme Procedure} mysql-service [#:config (mysql-configuration)]