(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 tls) #:use-module (guix build-system cmake) #:use-module (ice-9 match) #:use-module (guix gexp) #:use-module ((guix licenses) #:prefix license:) ) (define-public timescaledb (package (name "timescaledb") (version "2.9.3") (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 "0ybrd1h8cjfhvvld6s1p82jwifmd8grl9abv3626dzx59nrgyjbr")))) (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 gnu:postgresql)) (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-pg15 (package (inherit timescaledb) (inputs (list openssl gnu:postgresql-15)))) (define-public timescaledb-pg14 (package (inherit timescaledb) (inputs (list openssl gnu:postgresql-14)))) (define-public timescaledb-pg13 (package (inherit timescaledb) (inputs (list openssl gnu:postgresql-13)))) (define-public timescaledb-2.8-pg14 (package (inherit timescaledb) (name "timescaledb") (version "2.8.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 "1gbadna0ilmqad7sbrixm12wd71h43njhsbp1kh5lispb6drdb6r")))) (inputs (list openssl gnu:postgresql-14))))