about summary refs log tree commit diff
path: root/pkgs/servers
diff options
context:
space:
mode:
authorWolfgang Walther <walther@technowledgy.de>2024-02-29 19:31:41 +0100
committerWolfgang Walther <walther@technowledgy.de>2024-03-15 21:11:09 +0100
commit4b6bce5c313f82d57f711be4ca22dccf30d32c35 (patch)
tree82f1b8c018cf88036fdc105ed0f0261fa2a97c52 /pkgs/servers
parent14b3ea2789ef6b8bfb39553919708b6b5672ff67 (diff)
downloadnixlib-4b6bce5c313f82d57f711be4ca22dccf30d32c35.tar
nixlib-4b6bce5c313f82d57f711be4ca22dccf30d32c35.tar.gz
nixlib-4b6bce5c313f82d57f711be4ca22dccf30d32c35.tar.bz2
nixlib-4b6bce5c313f82d57f711be4ca22dccf30d32c35.tar.lz
nixlib-4b6bce5c313f82d57f711be4ca22dccf30d32c35.tar.xz
nixlib-4b6bce5c313f82d57f711be4ca22dccf30d32c35.tar.zst
nixlib-4b6bce5c313f82d57f711be4ca22dccf30d32c35.zip
postgresql: refactor to remove "this" argument
This was proposed by abbradar in #150801, but left out of the follow up PR
#221851 by Ma27 to reduce the size of the diff. Compared to the initial
proposal this includes the callPackage call in the recursion, which avoids
breaking the withJIT/withoutJIT helpers.

In terms of nixpkgs, this is a pure refactor, no derivations change. However,
this makes downstream expressions like the following possible:

  (postgresql.override { jitSupport = true; }).pkgs.postgis

This would have not worked before without passing another "this" argument,
which is error prone as can be seen in this example:

  https://github.com/PostgREST/postgrest/pull/3222/files
Diffstat (limited to 'pkgs/servers')
-rw-r--r--pkgs/servers/sql/postgresql/default.nix1
-rw-r--r--pkgs/servers/sql/postgresql/generic.nix6
2 files changed, 3 insertions, 4 deletions
diff --git a/pkgs/servers/sql/postgresql/default.nix b/pkgs/servers/sql/postgresql/default.nix
index d8acae8787a6..d11a2d06b2d2 100644
--- a/pkgs/servers/sql/postgresql/default.nix
+++ b/pkgs/servers/sql/postgresql/default.nix
@@ -16,7 +16,6 @@ let
       self.lib.nameValuePair attrName (import path {
         inherit jitSupport self;
         thisAttr = attrName;
-        this = self.${attrName};
       })
     ) versions;
 
diff --git a/pkgs/servers/sql/postgresql/generic.nix b/pkgs/servers/sql/postgresql/generic.nix
index 052460da27b2..a669cbb020fb 100644
--- a/pkgs/servers/sql/postgresql/generic.nix
+++ b/pkgs/servers/sql/postgresql/generic.nix
@@ -12,7 +12,7 @@ let
       , gssSupport ? with stdenv.hostPlatform; !isWindows && !isStatic
 
       # for postgresql.pkgs
-      , this, self, newScope, buildEnv
+      , self, newScope, buildEnv
 
       # source specification
       , version, hash, muslPatches
@@ -32,7 +32,7 @@ let
       # detection of crypt fails when using llvm stdenv, so we add it manually
       # for <13 (where it got removed: https://github.com/postgres/postgres/commit/c45643d618e35ec2fe91438df15abd4f3c0d85ca)
       , libxcrypt
-    }:
+    } @args:
   let
     atLeast = lib.versionAtLeast version;
     olderThan = lib.versionOlder version;
@@ -215,9 +215,9 @@ let
     disallowedReferences = [ stdenv'.cc ];
 
     passthru = let
+      this = self.callPackage generic args;
       jitToggle = this.override {
         jitSupport = !jitSupport;
-        this = jitToggle;
       };
     in
     {