@@ -0,0 +1,31 @@
1+{ lib, stdenv, fetchFromGitHub, pkg-config, R, postgresql }:
2+
3+stdenv.mkDerivation rec {
4+ pname = "plr";
5+ version = "8.4.1";
6+
7+ src = fetchFromGitHub {
8+ owner = "postgres-plr";
9+ repo = "plr";
10+ rev = "REL${builtins.replaceStrings ["."] ["_"] version}";
11+ sha256 = "1wy4blg8jl30kzhrkvbncl4gmy6k71zipnq89ykwi1vmx89v3ab7";
12+ };
13+
14+ nativeBuildInputs = [ pkg-config ];
15+ buildInputs = [ R postgresql ];
16+ preBuild = ''
17+ export USE_PGXS=1
18+ '';
19+ installPhase = ''
20+ install -D plr.so -t $out/lib/
21+ install -D {plr--unpackaged--8.4.1.sql,plr--8.4.1.sql,plr.control} -t $out/share/postgresql/extension
22+ '';
23+
24+ meta = with lib; {
25+ description = "PL/R - R Procedural Language for PostgreSQL";
26+ homepage = "https://github.com/postgres-plr/plr";
27+ maintainers = with maintainers; [ qoelet ];
28+ platforms = [ "x86_64-linux" ];
29+ license = licenses.gpl2Only;
30+ };
31+}