guix-glicid/glicid/packages/databases.scm

128 lines
8.2 KiB
Scheme

(define-module (glicid packages databases)
#:use-module (guix git-download)
#:use-module (guix download)
#:use-module (guix packages)
#:use-module ((gnu packages databases) #:prefix gnu:)
#:use-module (gnu packages)
#:use-module (gnu packages tls)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages icu4c)
#:use-module (gnu packages bison)
#:use-module (gnu packages flex)
#:use-module (gnu packages web)
#:use-module (guix build-system cmake)
#:use-module (ice-9 match)
#:use-module (guix gexp)
#:use-module ((guix licenses) #:prefix license:)
)
(define-public postgresql-16
(package
(inherit gnu:postgresql-15)
(name "postgresql")
(version "16.4")
(source (origin
(method url-fetch)
(uri (string-append "https://ftp.postgresql.org/pub/source/v" version "/postgresql-" version ".tar.bz2"))
(sha256 (base32 "0vvd73rzj0sl294v15bh8yslakqv412bxqzlkqxyjwxa8pb6c5wp"))))
(inputs `(("icu4c" ,icu4c)
("pkg-config" ,pkg-config)
,@(package-inputs gnu:postgresql-15)))))
; not yet public as the checks fails on jsonb_jsonpath
(define postgresql-17
(package
(inherit postgresql-16)
(name "postgresql")
(version "17.0")
(source (origin
(method url-fetch)
(uri (string-append "https://ftp.postgresql.org/pub/source/v" version "/postgresql-" version ".tar.bz2"))
(sha256 (base32 "1ph9j60nxwcslpdji4q0snc3932bn8xrpbfvi0jvdmpxq0qn29vy"))))
(inputs `(("icu4c" ,icu4c)
("pkg-config" ,pkg-config)
("bison" ,bison)
("flex" ,flex)
("json-c" ,json-c)
,@(package-inputs postgresql-16)))))
(define-public timescaledb
(package
(name "timescaledb")
(version "2.17.1")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/timescale/timescaledb")
(commit version)))
(file-name (git-file-name name version))
(sha256 (base32 "1mfwbi36q6xsi9x81gwy8diijkqqdq297xhsln11a73hq88dlv3a"))))
(build-system cmake-build-system)
(arguments
(list #:imported-modules `((guix build union)
,@%cmake-build-system-modules)
#:modules `(,@%cmake-build-system-modules
(guix build union)
(ice-9 match))
#:configure-flags #~(list "-DSEND_TELEMETRY_DEFAULT=OFF")
#:test-target "regresschecklocal"
#:phases
#~(modify-phases (@ (guix build cmake-build-system) %standard-phases)
(add-after 'unpack 'patch-install-location
(lambda _
(substitute* '("CMakeLists.txt"
"cmake/GenerateScripts.cmake"
"sql/CMakeLists.txt")
(("\\$\\{PG_SHAREDIR\\}/extension") (string-append #$output "/share/extension")))
(substitute* '("src/CMakeLists.txt"
"src/loader/CMakeLists.txt"
"tsl/src/CMakeLists.txt")
(("\\$\\{PG_PKGLIBDIR\\}") (string-append #$output "/lib")))))
(add-after 'unpack 'remove-kernel-version
(lambda _
(substitute* "src/config.h.in"
(("BUILD_OS_VERSION ..CMAKE_SYSTEM_VERSION.")
"BUILD_OS_VERSION \""))))
(delete 'check)
(add-after 'install 'prepare-tests
(lambda* (#:key inputs #:allow-other-keys)
(let ((pg-data (string-append (getcwd) "/../pg-data"))
(pg-union (string-append (getcwd) "/../pg-union")))
(match inputs
(((names . directories) ...)
(union-build pg-union (cons #$output directories)
#:symlink
(lambda (old new)
(if (file-is-directory? old)
(copy-recursively old new)
(copy-file old new))))))
(setenv "PATH" (string-append pg-union "/bin:" (getenv "PATH")))
(invoke "initdb" "-D" pg-data)
(copy-file "test/postgresql.conf" (string-append pg-data "/postgresql.conf"))
(invoke "pg_ctl" "-D" pg-data
"-o" (string-append "-k " pg-data)
"-l" (string-append pg-data "/db.log")
"start"))))
(add-after 'prepare-tests 'check
(assoc-ref %standard-phases 'check)))))
(inputs (list openssl postgresql-16))
(home-page "https://www.timescale.com/")
(synopsis "Time-series extension for PostgreSQL")
(description "TimescaleDB is a database designed to make SQL scalable for
time-series data. It is engineered up from PostgreSQL and packaged as a
PostgreSQL extension, providing automatic partitioning across time and space
(partitioning key), as well as full SQL support.")
(license license:asl2.0)))
(define-public timescaledb-2.13
(package
(inherit timescaledb)
(name "timescaledb")
(version "2.13.1")
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/timescale/timescaledb")
(commit version)))
(file-name (git-file-name name version))
(sha256 (base32 "1qs97c70rlmsi15mwlknk3p6bs1zm7z4pl4qwwpgqzvwrlgixqzc"))))))