summary refs log tree commit diff
path: root/pkgs/servers/sql/postgresql/ext
diff options
context:
space:
mode:
authorMario Rodas <marsam@users.noreply.github.com>2023-10-06 08:14:03 -0500
committerGitHub <noreply@github.com>2023-10-06 08:14:03 -0500
commit3bbc6d88513e1d0b4d58c8a9cb2b9ecd6c86d72b (patch)
treec5c1ea7586c52922b4c269e8b332e325c4165df7 /pkgs/servers/sql/postgresql/ext
parent76dc04b0ad524dd22c2c7e5ae60398eedfa6beae (diff)
parent15e72c0adc935e06cc800c49bc3d91be8147d395 (diff)
downloadnixpkgs-3bbc6d88513e1d0b4d58c8a9cb2b9ecd6c86d72b.tar
nixpkgs-3bbc6d88513e1d0b4d58c8a9cb2b9ecd6c86d72b.tar.gz
nixpkgs-3bbc6d88513e1d0b4d58c8a9cb2b9ecd6c86d72b.tar.bz2
nixpkgs-3bbc6d88513e1d0b4d58c8a9cb2b9ecd6c86d72b.tar.lz
nixpkgs-3bbc6d88513e1d0b4d58c8a9cb2b9ecd6c86d72b.tar.xz
nixpkgs-3bbc6d88513e1d0b4d58c8a9cb2b9ecd6c86d72b.tar.zst
nixpkgs-3bbc6d88513e1d0b4d58c8a9cb2b9ecd6c86d72b.zip
Merge pull request #258755 from marsam/postgresql-pg_hint_plan-support-more-versions
postgresqlPackages.pg_hint_plan: support more PostgreSQL versions
Diffstat (limited to 'pkgs/servers/sql/postgresql/ext')
-rw-r--r--pkgs/servers/sql/postgresql/ext/pg_hint_plan.nix52
1 files changed, 41 insertions, 11 deletions
diff --git a/pkgs/servers/sql/postgresql/ext/pg_hint_plan.nix b/pkgs/servers/sql/postgresql/ext/pg_hint_plan.nix
index 25d27fcdfcb..f710c5c3d38 100644
--- a/pkgs/servers/sql/postgresql/ext/pg_hint_plan.nix
+++ b/pkgs/servers/sql/postgresql/ext/pg_hint_plan.nix
@@ -1,24 +1,55 @@
 { lib, stdenv, fetchFromGitHub, postgresql }:
 
-stdenv.mkDerivation rec {
+let
+  source = {
+    "16" = {
+      version = "1.6.0";
+      hash = "sha256-lg7N0QblluTgtNo1tGZjirNJSyQXtcAEs9Jqd3zx0Sg=";
+    };
+    "15" = {
+      version = "1.5.1";
+      hash = "sha256-o8Hepf/Mc1ClRTLZ6PBdqU4jSdlz+ijVgl2vJKmIc6M=";
+    };
+    "14" = {
+      version = "1.4.2";
+      hash = "sha256-nGyKcNY57RdQdZKSaBPk2/YbT0Annz1ZevH0lKswdhA=";
+    };
+    "13" = {
+      version = "1.3.9";
+      hash = "sha256-KGcHDwk8CgNHPZARfLBfS8r7TRCP9LPjT+m4fNSnnW0=";
+    };
+    "12" = {
+      version = "1.3.9";
+      hash = "sha256-64/dlm6e4flCxMQ8efsxfKSlja+Tko0zsghTgLatN+Y=";
+    };
+    "11" = {
+      version = "1.3.9";
+      hash = "sha256-8t/HhB/2Kjx4xMItmmKv3g9gba5VCBHdplYtYD/3UhA=";
+    };
+  }.${lib.versions.major postgresql.version} or (throw "Source for pg_hint_plan is not available for ${postgresql.version}");
+in
+stdenv.mkDerivation {
   pname = "pg_hint_plan";
-  version = "14-1.4.0";
+  inherit (source) version;
 
   src = fetchFromGitHub {
     owner = "ossc-db";
-    repo = pname;
-    rev = "REL${builtins.replaceStrings ["-" "."] ["_" "_"] version}";
-    sha256 = "sha256-2hYDn/69264x2lMRVIp/I5chjocL6UqIw5ry1qdRcDM=";
+    repo = "pg_hint_plan";
+    rev = "REL${lib.versions.major postgresql.version}_${builtins.replaceStrings ["."] ["_"] source.version}";
+    inherit (source) hash;
   };
 
+  postPatch = lib.optionalString (lib.versionOlder postgresql.version "14") ''
+    # https://github.com/ossc-db/pg_hint_plan/commit/e9e564ad59b8bd4a03e0f13b95b5122712e573e6
+    substituteInPlace Makefile --replace "LDFLAGS+=-Wl,--build-id" ""
+  '';
+
   buildInputs = [ postgresql ];
 
   installPhase = ''
-    mkdir -p $out/{lib,share/postgresql/extension}
-
-    cp *.so      $out/lib
-    cp *.sql     $out/share/postgresql/extension
-    cp *.control $out/share/postgresql/extension
+    install -D -t $out/lib pg_hint_plan.so
+    install -D -t $out/share/postgresql/extension *.sql
+    install -D -t $out/share/postgresql/extension *.control
   '';
 
   meta = with lib; {
@@ -27,6 +58,5 @@ stdenv.mkDerivation rec {
     maintainers = with maintainers; [ _1000101 ];
     platforms = postgresql.meta.platforms;
     license = licenses.bsd3;
-    broken = versionOlder postgresql.version "14";
   };
 }