From 0d57a50af28056cbe4a3c215e1a3cc95d88bba1c Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Fri, 14 Sep 2018 21:44:08 +0200 Subject: 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. --- doc/guix.texi | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'doc/guix.texi') 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)] -- cgit 1.4.1