nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 openssl,
7 libpq,
8 zstd,
9 fetchpatch,
10}:
11
12stdenv.mkDerivation rec {
13 pname = "odyssey";
14 version = "1.3";
15
16 src = fetchFromGitHub {
17 owner = "yandex";
18 repo = "odyssey";
19 rev = version;
20 sha256 = "sha256-1ALTKRjpKmmFcAuhmgpcbJBkNuUlTyau8xWDRHh7gf0=";
21 };
22
23 patches = [
24 # Fix compression build. Remove with the next release. https://github.com/yandex/odyssey/pull/441
25 (fetchpatch {
26 url = "https://github.com/yandex/odyssey/commit/01ca5b345c4483add7425785c9c33dfa2c135d63.patch";
27 sha256 = "sha256-8UPkZkiI08ZZL6GShhug/5/kOVrmdqYlsD1bcqfxg/w=";
28 })
29 # Fixes kiwi build.
30 ./fix-missing-c-header.patch
31 ];
32
33 nativeBuildInputs = [ cmake ];
34 buildInputs = [
35 openssl
36 libpq
37 zstd
38 ];
39
40 env.NIX_CFLAGS_COMPILE = "-Wno-error=implicit-int -Wno-error=incompatible-pointer-types";
41
42 cmakeFlags = [
43 "-DBUILD_COMPRESSION=ON"
44 "-DPOSTGRESQL_INCLUDE_DIR=${lib.getDev libpq}/include/postgresql/server"
45 "-DPOSTGRESQL_LIBRARY=${libpq}/lib"
46 "-DPOSTGRESQL_LIBPGPORT=${lib.getDev libpq}/lib"
47 ];
48
49 installPhase = ''
50 install -Dm755 -t $out/bin sources/odyssey
51 '';
52
53 meta = with lib; {
54 description = "Scalable PostgreSQL connection pooler";
55 homepage = "https://github.com/yandex/odyssey";
56 license = licenses.bsd3;
57 maintainers = [ ];
58 platforms = [ "x86_64-linux" ];
59 mainProgram = "odyssey";
60 };
61}