nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, fetchFromGitHub, cmake, postgresql, openssl }:
2
3# # To enable on NixOS:
4# config.services.postgresql = {
5# extraPlugins = [ pkgs.timescaledb ];
6# extraConfig = "shared_preload_libraries = 'timescaledb'";
7# }
8
9stdenv.mkDerivation rec {
10 name = "timescaledb-${version}";
11 version = "1.0.0";
12
13 nativeBuildInputs = [ cmake ];
14 buildInputs = [ postgresql openssl ];
15
16 src = fetchFromGitHub {
17 owner = "timescale";
18 repo = "timescaledb";
19 rev = "refs/tags/${version}";
20 sha256 = "1359jc0dw8q3f0iipqfadzs8lvri9qa5w59ziz00x1d09ppw2q40";
21 };
22
23 # Fix the install phase which tries to install into the pgsql extension dir,
24 # and cannot be manually overridden. This is rather fragile but works OK.
25 patchPhase = ''
26 for x in CMakeLists.txt sql/CMakeLists.txt; do
27 substituteInPlace "$x" \
28 --replace 'DESTINATION "''${PG_SHAREDIR}/extension"' "DESTINATION \"$out/share/extension\""
29 done
30
31 for x in src/CMakeLists.txt src/loader/CMakeLists.txt; do
32 substituteInPlace "$x" \
33 --replace 'DESTINATION ''${PG_PKGLIBDIR}' "DESTINATION \"$out/lib\""
34 done
35 '';
36
37 postInstall = ''
38 # work around an annoying bug, by creating $out/bin, so buildEnv doesn't freak out later
39 # see https://github.com/NixOS/nixpkgs/issues/22653
40
41 mkdir -p $out/bin
42 '';
43
44 meta = with stdenv.lib; {
45 description = "Scales PostgreSQL for time-series data via automatic partitioning across time and space";
46 homepage = https://www.timescale.com/;
47 maintainers = with maintainers; [ volth ];
48 platforms = platforms.linux;
49 license = licenses.asl20;
50 };
51}