unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Carlo Zancanaro <carlo@zancanaro.id.au>
To: Gary Johnson <lambdatronic@disroot.org>
Cc: help-guix@gnu.org
Subject: Re: How do I correctly relocate PostGIS control files?
Date: Tue, 10 Nov 2020 13:14:44 +1100	[thread overview]
Message-ID: <87ft5ihsa3.fsf@zancanaro.id.au> (raw)
In-Reply-To: <87lffa84on.fsf@disroot.org>

[-- Attachment #1: Type: text/plain, Size: 2394 bytes --]

Hi Gary,

On Tue, Nov 10 2020, Gary Johnson wrote:
> It's been a week since my original post requesting assistance 
> with getting Postgresql and PostGIS to work together correctly, 
> but unfortunately I still haven't received any help with this 
> issue.
> ...
> Does anyone know how this code works or how to fix this issue?

I didn't respond initially because I don't have any specialist 
knowledge about this. I had some free time today, so I did a bit 
of an investigation and I think I've figured out what's gone wrong 
for you here.

In your original email you gave this definition for postgresql-13:

    (define-public postgresql-13
      (package
       (inherit postgresql)
       (name "postgresql")
       (version "13.0")
       (source (origin
                (method url-fetch)
                (uri (string-append 
                "https://ftp.postgresql.org/pub/source/v"
                                    version "/postgresql-" version 
                                    ".tar.bz2"))
                (sha256
                 (base32
                  "15i2b7m9a9430idqdgvrcyx66cpxz0v2d81nfqcm8ss3inz51rw0"))))))

However, this is missing one important line from the original 
postgresql definition, which applies a patch to the source:

    (patches (search-patches 
    "postgresql-disable-resolve_symlinks.patch"))

This patch changes how Postgres treats symlinks, which Guix uses 
extensively. If we add this patch the definition of postgresql-13 
we should get:

    (define-public postgresql-13
      (package
       (inherit postgresql)
       (name "postgresql")
       (version "13.0")
       (source (origin
                (method url-fetch)
                (uri (string-append 
                "https://ftp.postgresql.org/pub/source/v"
                                    version "/postgresql-" version 
                                    ".tar.bz2"))
                (sha256
                 (base32
                  "15i2b7m9a9430idqdgvrcyx66cpxz0v2d81nfqcm8ss3inz51rw0"))
                (patches (search-patches 
                "postgresql-disable-resolve_symlinks.patch"))))))

I put this into a system definition (a bit hacky, but attached) 
and built it using "guix system vm helping-gary.scm". Logging into 
the system as root I was able to run this successfully:

    sudo -u postgres psql -c 'create extension postgis'

I hope that helps!

Carlo


[-- Attachment #2: helping-gary.scm --]
[-- Type: application/octet-stream, Size: 1978 bytes --]

(use-modules (gnu)
             (guix modules)
             (guix packages)
             (guix download)
             (gnu system file-systems)
             (gnu packages databases)
             (gnu packages geo)
             (gnu packages image)
             (gnu packages web)
             (gnu packages image)
             (gnu packages xml)
             (gnu packages pcre)
             (gnu services databases)
             (gnu services desktop))

(define-public postgresql-13
  (package
   (inherit postgresql)
   (name "postgresql")
   (version "13.0")
   (source (origin
            (method url-fetch)
            (uri (string-append "https://ftp.postgresql.org/pub/source/v"
                                version "/postgresql-" version ".tar.bz2"))
            (sha256
             (base32
              "15i2b7m9a9430idqdgvrcyx66cpxz0v2d81nfqcm8ss3inz51rw0"))
            (patches (search-patches "postgresql-disable-resolve_symlinks.patch"))))
   (arguments `(#:tests? #f ,@(package-arguments postgresql)))))

(define-public postgis-for-postgresql-13
  (package
   (inherit postgis)
   (name "postgis")
   (version "3.0.2")
   (inputs
    `(("gdal" ,gdal)
      ("geos" ,geos)
      ("giflib" ,giflib)
      ("json-c" ,json-c)
      ("libjpeg" ,libjpeg-turbo)
      ("libxml2" ,libxml2)
      ("pcre" ,pcre)
      ("postgresql" ,postgresql-13)
      ("proj" ,proj)))))

(operating-system
  (bootloader (bootloader-configuration
               (bootloader grub-bootloader)
               (target "/dev/vda")))
  (host-name "??")
  (file-systems %base-file-systems)
  (timezone "UTC")
  (packages (cons* postgresql-13 postgis-for-postgresql-13 %base-packages))
  (services (cons* (service postgresql-service-type (postgresql-configuration
                                                     (postgresql postgresql-13)
                                                     (extension-packages (list postgis-for-postgresql-13))))
                   %base-services)))

  parent reply	other threads:[~2020-11-10  2:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02 22:40 How do I correctly relocate PostGIS control files? Gary Johnson
2020-11-03  2:23 ` Julien Lepiller
2020-11-04  0:38   ` Gary Johnson
2020-11-09 23:56     ` Gary Johnson
2020-11-10  1:45       ` Julien Lepiller
2020-11-10  2:14       ` Carlo Zancanaro [this message]
2020-11-10 17:45         ` Gary Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ft5ihsa3.fsf@zancanaro.id.au \
    --to=carlo@zancanaro.id.au \
    --cc=help-guix@gnu.org \
    --cc=lambdatronic@disroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).