diff --git a/pkgs/by-name/pg/pgdog/package.nix b/pkgs/by-name/pg/pgdog/package.nix new file mode 100644 index 000000000000..6256297621db --- /dev/null +++ b/pkgs/by-name/pg/pgdog/package.nix @@ -0,0 +1,64 @@ +{ + lib, + clangStdenv, + fetchFromGitHub, + openssl, + pkg-config, + rustPlatform, + useMoldLinker, + versionCheckHook, + withMold ? with clangStdenv.hostPlatform; isUnix && !isDarwin, +}: +let + stdenv = if withMold then useMoldLinker clangStdenv else clangStdenv; +in +rustPlatform.buildRustPackage.override { inherit stdenv; } (finalAttrs: { + pname = "pgdog"; + version = "0.1.28"; + + src = fetchFromGitHub { + owner = "pgdogdev"; + repo = "pgdog"; + tag = "v${finalAttrs.version}"; + hash = "sha256-3TRpjLlyS9XKqBPCUqW0ilwaMiAXRzg1RdF9x3GYnxY="; + }; + + cargoHash = "sha256-iqUB9m2MXbl4rgwTH2TYF6lqbpkMFng5pUAzUXzhhJs="; + + # Hardcoded paths for C compiler and linker + postPatch = '' + rm .cargo/config.toml + ''; + + cargoBuildFlags = [ + "--package" + "pgdog" + ]; + + nativeBuildInputs = [ + pkg-config + rustPlatform.bindgenHook + ]; + + buildInputs = [ + openssl + ]; + + strictDeps = true; + + # Several tests rely on networking + doCheck = false; + + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + + meta = { + description = "PostgreSQL connection pooler, load balancer, and database sharder"; + homepage = "https://pgdog.dev/"; + changelog = "https://github.com/pgdogdev/pgdog/releases/tag/v${finalAttrs.version}"; + license = lib.licenses.agpl3Only; + mainProgram = "pgdog"; + maintainers = with lib.maintainers; [ EpicEric ]; + platforms = lib.platforms.all; + }; +})