|
| 1 | +{ lib, stdenv, fetchFromGitHub, cmake, postgresql, openssl, libkrb5 }: |
| 2 | + |
| 3 | +stdenv.mkDerivation rec { |
| 4 | + pname = "timescaledb-apache"; |
| 5 | + version = "2.9.1"; |
| 6 | + |
| 7 | + nativeBuildInputs = [ cmake ]; |
| 8 | + buildInputs = [ postgresql openssl libkrb5 ]; |
| 9 | + |
| 10 | + src = fetchFromGitHub { |
| 11 | + owner = "timescale"; |
| 12 | + repo = "timescaledb"; |
| 13 | + rev = version; |
| 14 | + hash = "sha256-fvVSxDiGZAewyuQ2vZDb0I6tmlDXl6trjZp8+qDBtb8="; |
| 15 | + }; |
| 16 | + |
| 17 | + cmakeFlags = [ "-DSEND_TELEMETRY_DEFAULT=OFF" "-DREGRESS_CHECKS=OFF" "-DTAP_CHECKS=OFF" "-DAPACHE_ONLY=1" ] |
| 18 | + ++ lib.optionals stdenv.isDarwin [ "-DLINTER=OFF" ]; |
| 19 | + |
| 20 | + # Fix the install phase which tries to install into the pgsql extension dir, |
| 21 | + # and cannot be manually overridden. This is rather fragile but works OK. |
| 22 | + postPatch = '' |
| 23 | + for x in CMakeLists.txt sql/CMakeLists.txt; do |
| 24 | + substituteInPlace "$x" \ |
| 25 | + --replace 'DESTINATION "''${PG_SHAREDIR}/extension"' "DESTINATION \"$out/share/postgresql/extension\"" |
| 26 | + done |
| 27 | +
|
| 28 | + for x in src/CMakeLists.txt src/loader/CMakeLists.txt tsl/src/CMakeLists.txt; do |
| 29 | + substituteInPlace "$x" \ |
| 30 | + --replace 'DESTINATION ''${PG_PKGLIBDIR}' "DESTINATION \"$out/lib\"" |
| 31 | + done |
| 32 | + ''; |
| 33 | + |
| 34 | + |
| 35 | + # timescaledb-2.9.1.so already exists in the lib directory |
| 36 | + # we have no need for the timescaledb.so or control file |
| 37 | + postInstall = '' |
| 38 | + rm $out/lib/timescaledb.so |
| 39 | + mv $out/share/postgresql/extension/timescaledb.control $out/share/postgresql/extension/timescaledb-2.9.1.control |
| 40 | + ''; |
| 41 | + |
| 42 | + meta = with lib; { |
| 43 | + description = "Scales PostgreSQL for time-series data via automatic partitioning across time and space"; |
| 44 | + homepage = "https://www.timescale.com/"; |
| 45 | + changelog = "https://github.com/timescale/timescaledb/blob/${version}/CHANGELOG.md"; |
| 46 | + maintainers = with maintainers; [ samrose ]; |
| 47 | + platforms = postgresql.meta.platforms; |
| 48 | + license = licenses.asl20; |
| 49 | + broken = versionOlder postgresql.version "13"; |
| 50 | + }; |
| 51 | +} |
0 commit comments