mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-14 01:33:10 +00:00
4b6bce5c31
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
25 lines
559 B
Nix
25 lines
559 B
Nix
self:
|
|
let
|
|
versions = {
|
|
postgresql_12 = ./12.nix;
|
|
postgresql_13 = ./13.nix;
|
|
postgresql_14 = ./14.nix;
|
|
postgresql_15 = ./15.nix;
|
|
postgresql_16 = ./16.nix;
|
|
};
|
|
|
|
mkAttributes = jitSupport:
|
|
self.lib.mapAttrs' (version: path:
|
|
let
|
|
attrName = if jitSupport then "${version}_jit" else version;
|
|
in
|
|
self.lib.nameValuePair attrName (import path {
|
|
inherit jitSupport self;
|
|
thisAttr = attrName;
|
|
})
|
|
) versions;
|
|
|
|
in
|
|
# variations without and with JIT
|
|
(mkAttributes false) // (mkAttributes true)
|