2023-04-12 12:48:02 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, postgresql, openssl, libkrb5, enableUnfree ? true }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# # To enable on NixOS:
|
2023-02-02 18:25:31 +00:00
|
|
|
# config.services.postgresql = let
|
|
|
|
# # The postgresql pkgs has to be taken from the
|
|
|
|
# # postgresql package used, so the extensions
|
|
|
|
# # are built for the correct postgresql version.
|
|
|
|
# postgresqlPackages = config.services.postgresql.package.pkgs;
|
|
|
|
# in {
|
|
|
|
# extraPlugins = with postgresqlPackages; [ timescaledb ];
|
|
|
|
# settings.shared_preload_libraries = "timescaledb";
|
2020-04-24 23:36:52 +00:00
|
|
|
# }
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2023-04-12 12:48:02 +00:00
|
|
|
pname = "timescaledb${lib.optionalString (!enableUnfree) "-apache"}";
|
2023-04-29 16:46:19 +00:00
|
|
|
version = "2.10.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
2021-05-20 23:08:51 +00:00
|
|
|
buildInputs = [ postgresql openssl libkrb5 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2022-03-05 16:20:37 +00:00
|
|
|
owner = "timescale";
|
|
|
|
repo = "timescaledb";
|
2022-04-27 09:35:20 +00:00
|
|
|
rev = version;
|
2023-04-29 16:46:19 +00:00
|
|
|
sha256 = "sha256-gI5zPEg2jKQhK63E2rvPd6laF3dmP52oHg/UMitHifk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
cmakeFlags = [ "-DSEND_TELEMETRY_DEFAULT=OFF" "-DREGRESS_CHECKS=OFF" "-DTAP_CHECKS=OFF" ]
|
2023-04-12 12:48:02 +00:00
|
|
|
++ lib.optionals (!enableUnfree) [ "-DAPACHE_ONLY=ON" ]
|
2021-04-17 00:35:05 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ "-DLINTER=OFF" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Fix the install phase which tries to install into the pgsql extension dir,
|
|
|
|
# and cannot be manually overridden. This is rather fragile but works OK.
|
2021-04-17 00:35:05 +00:00
|
|
|
postPatch = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
for x in CMakeLists.txt sql/CMakeLists.txt; do
|
|
|
|
substituteInPlace "$x" \
|
|
|
|
--replace 'DESTINATION "''${PG_SHAREDIR}/extension"' "DESTINATION \"$out/share/postgresql/extension\""
|
|
|
|
done
|
|
|
|
|
|
|
|
for x in src/CMakeLists.txt src/loader/CMakeLists.txt tsl/src/CMakeLists.txt; do
|
|
|
|
substituteInPlace "$x" \
|
|
|
|
--replace 'DESTINATION ''${PG_PKGLIBDIR}' "DESTINATION \"$out/lib\""
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Scales PostgreSQL for time-series data via automatic partitioning across time and space";
|
2022-03-05 16:20:37 +00:00
|
|
|
homepage = "https://www.timescale.com/";
|
|
|
|
changelog = "https://github.com/timescale/timescaledb/raw/${version}/CHANGELOG.md";
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = with maintainers; [ marsam ];
|
2022-03-05 16:20:37 +00:00
|
|
|
platforms = postgresql.meta.platforms;
|
2023-04-12 12:48:02 +00:00
|
|
|
license = with licenses; if enableUnfree then tsl else asl20;
|
2022-03-05 16:20:37 +00:00
|
|
|
broken = versionOlder postgresql.version "12";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|