about summary refs log tree commit diff
path: root/pkgs/servers/sql
diff options
context:
space:
mode:
authorWolfgang Walther <walther@technowledgy.de>2024-03-02 14:04:06 +0100
committerWolfgang Walther <walther@technowledgy.de>2024-03-15 21:11:09 +0100
commit14b3ea2789ef6b8bfb39553919708b6b5672ff67 (patch)
treef640c2c50b271b05b4700f6a7ae92e0fbcd9f10c /pkgs/servers/sql
parentb301c01e3121068b29c04d26fdcd2a71db92fc4d (diff)
postgresql: refactor to pass jitSupport/llvm via scope instead of passthru
This makes it less error-prone to use the llvm package in extensions, because
it will always match the package used by the postgresql derivation itself.

Previously, you could've accidentally used llvm instead of postgresql.llvm
with a different result.
Diffstat (limited to 'pkgs/servers/sql')
-rw-r--r--pkgs/servers/sql/postgresql/ext/anonymizer.nix4
-rw-r--r--pkgs/servers/sql/postgresql/ext/plv8/default.nix3
-rw-r--r--pkgs/servers/sql/postgresql/ext/postgis.nix4
-rw-r--r--pkgs/servers/sql/postgresql/generic.nix5
4 files changed, 9 insertions, 7 deletions
diff --git a/pkgs/servers/sql/postgresql/ext/anonymizer.nix b/pkgs/servers/sql/postgresql/ext/anonymizer.nix
index 430911d40108e..b6ec0256ae097 100644
--- a/pkgs/servers/sql/postgresql/ext/anonymizer.nix
+++ b/pkgs/servers/sql/postgresql/ext/anonymizer.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, pg-dump-anon, postgresql, runtimeShell }:
+{ lib, stdenv, pg-dump-anon, postgresql, runtimeShell, jitSupport, llvm }:
 
 stdenv.mkDerivation (finalAttrs: {
   pname = "postgresql_anonymizer";
@@ -6,7 +6,7 @@ stdenv.mkDerivation (finalAttrs: {
   inherit (pg-dump-anon) version src passthru;
 
   buildInputs = [ postgresql ];
-  nativeBuildInputs = [ postgresql ] ++ lib.optional postgresql.jitSupport postgresql.llvm;
+  nativeBuildInputs = [ postgresql ] ++ lib.optional jitSupport llvm;
 
   strictDeps = true;
 
diff --git a/pkgs/servers/sql/postgresql/ext/plv8/default.nix b/pkgs/servers/sql/postgresql/ext/plv8/default.nix
index 241aa610c8f9e..fa2f1b7ad2d8e 100644
--- a/pkgs/servers/sql/postgresql/ext/plv8/default.nix
+++ b/pkgs/servers/sql/postgresql/ext/plv8/default.nix
@@ -4,6 +4,7 @@
 , v8
 , perl
 , postgresql
+, jitSupport
 # For test
 , runCommand
 , coreutils
@@ -138,6 +139,6 @@ stdenv.mkDerivation (finalAttrs: {
     maintainers = with maintainers; [ marsam ];
     platforms = [ "x86_64-linux" "aarch64-linux" ];
     license = licenses.postgresql;
-    broken = postgresql.jitSupport;
+    broken = jitSupport;
   };
 })
diff --git a/pkgs/servers/sql/postgresql/ext/postgis.nix b/pkgs/servers/sql/postgresql/ext/postgis.nix
index 87333fe975040..f069a1b7e90d1 100644
--- a/pkgs/servers/sql/postgresql/ext/postgis.nix
+++ b/pkgs/servers/sql/postgresql/ext/postgis.nix
@@ -13,6 +13,8 @@
 , libiconv
 , pcre2
 , nixosTests
+, jitSupport
+, llvm
 }:
 
 let
@@ -31,7 +33,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libxml2 postgresql geos proj gdal json_c protobufc pcre2.dev ]
                 ++ lib.optional stdenv.isDarwin libiconv;
-  nativeBuildInputs = [ perl pkg-config ] ++ lib.optional postgresql.jitSupport postgresql.llvm;
+  nativeBuildInputs = [ perl pkg-config ] ++ lib.optional jitSupport llvm;
   dontDisableStatic = true;
 
   # postgis config directory assumes /include /lib from the same root for json-c library
diff --git a/pkgs/servers/sql/postgresql/generic.nix b/pkgs/servers/sql/postgresql/generic.nix
index cdcffc5f135cb..052460da27b22 100644
--- a/pkgs/servers/sql/postgresql/generic.nix
+++ b/pkgs/servers/sql/postgresql/generic.nix
@@ -221,7 +221,6 @@ let
       };
     in
     {
-      inherit jitSupport;
       psqlSchema = lib.versions.major version;
 
       withJIT = if jitSupport then this else jitToggle;
@@ -231,6 +230,8 @@ let
 
       pkgs = let
         scope = {
+          inherit jitSupport;
+          inherit (llvmPackages) llvm;
           postgresql = this;
           stdenv = stdenv';
           buildPgxExtension = buildPgxExtension.override {
@@ -257,8 +258,6 @@ let
       } // lib.optionalAttrs jitSupport {
         postgresql-jit = nixosTests.postgresql-jit.${thisAttr};
       };
-    } // lib.optionalAttrs jitSupport {
-      inherit (llvmPackages) llvm;
     };
 
     meta = with lib; {