1{ lib
2, stdenv
3, fetchFromGitHub
4, rustPlatform
5, darwin
6}:
7
8rustPlatform.buildRustPackage rec {
9 pname = "pgcat";
10 version = "1.1.1";
11
12 src = fetchFromGitHub {
13 owner = "postgresml";
14 repo = "pgcat";
15 rev = "v${version}";
16 hash = "sha256-BERxdGgPk8POnhLsyy4lKV4LCoHsJTmv2OhAOz6CKKc=";
17 };
18
19 cargoHash = "sha256-GwcqR8pEvz42NEmcuXpcoPdChzRBYsDEnllX62T8ulQ=";
20
21 buildInputs = lib.optionals stdenv.isDarwin [
22 darwin.apple_sdk.frameworks.Security
23 ];
24
25 checkFlags = [
26 # requires network access
27 "--skip=dns_cache::CachedResolver::lookup_ip"
28 "--skip=dns_cache::CachedResolver::new"
29 "--skip=dns_cache::CachedResolver"
30 "--skip=dns_cache::tests::has_changed"
31 "--skip=dns_cache::tests::incorrect_address"
32 "--skip=dns_cache::tests::lookup_ip"
33 "--skip=dns_cache::tests::new"
34 "--skip=dns_cache::tests::thread"
35 "--skip=dns_cache::tests::unknown_host"
36 ];
37
38 doInstallCheck = true;
39 installCheckPhase = ''
40 $out/bin/pgcat --version | grep "pgcat ${version}"
41 '';
42
43 meta = with lib; {
44 homepage = "https://github.com/postgresml/pgcat";
45 description = "PostgreSQL pooler with sharding, load balancing and failover support";
46 license = with licenses; [mit];
47 platforms = platforms.unix;
48 maintainers = with maintainers; [cathalmullan];
49 mainProgram = "pgcat";
50 };
51}