mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-29 06:45:54 +03:00
nixos/postgresql: fix enableJIT
Make sure that JIT is actually available when using services.postgresql = { enable = true; enableJIT = true; package = pkgs.postgresql_15; }; The current behavior is counter-intuitive because the docs state that `enableJIT = true;` is sufficient even though it wasn't in that case because the declared package doesn't have the LLVM dependency. Fixed by using `package.withJIT` if `enableJIT = true;` and `package.jitSupport` is `false`. Also updated the postgresql-jit test to test for that case.
This commit is contained in:
parent
a5a715bb24
commit
e2fb651752
@ -7,9 +7,18 @@ let
|
|||||||
cfg = config.services.postgresql;
|
cfg = config.services.postgresql;
|
||||||
|
|
||||||
postgresql =
|
postgresql =
|
||||||
|
let
|
||||||
|
# ensure that
|
||||||
|
# services.postgresql = {
|
||||||
|
# enableJIT = true;
|
||||||
|
# package = pkgs.postgresql_<major>;
|
||||||
|
# };
|
||||||
|
# works.
|
||||||
|
base = if cfg.enableJIT && !cfg.package.jitSupport then cfg.package.withJIT else cfg.package;
|
||||||
|
in
|
||||||
if cfg.extraPlugins == []
|
if cfg.extraPlugins == []
|
||||||
then cfg.package
|
then base
|
||||||
else cfg.package.withPackages (_: cfg.extraPlugins);
|
else base.withPackages (_: cfg.extraPlugins);
|
||||||
|
|
||||||
toStr = value:
|
toStr = value:
|
||||||
if true == value then "yes"
|
if true == value then "yes"
|
||||||
|
@ -7,9 +7,7 @@ with import ../lib/testing-python.nix { inherit system pkgs; };
|
|||||||
|
|
||||||
let
|
let
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
packages = lib.filter
|
packages = builtins.attrNames (import ../../pkgs/servers/sql/postgresql pkgs);
|
||||||
(lib.hasSuffix "_jit")
|
|
||||||
(builtins.attrNames (import ../../pkgs/servers/sql/postgresql pkgs));
|
|
||||||
|
|
||||||
mkJitTest = packageName: makeTest {
|
mkJitTest = packageName: makeTest {
|
||||||
name = "${packageName}";
|
name = "${packageName}";
|
||||||
@ -17,8 +15,8 @@ let
|
|||||||
nodes.machine = { pkgs, lib, ... }: {
|
nodes.machine = { pkgs, lib, ... }: {
|
||||||
services.postgresql = {
|
services.postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
enableJIT = true;
|
||||||
package = pkgs.${packageName};
|
package = pkgs.${packageName};
|
||||||
settings.jit = "on";
|
|
||||||
initialScript = pkgs.writeText "init.sql" ''
|
initialScript = pkgs.writeText "init.sql" ''
|
||||||
create table demo (id int);
|
create table demo (id int);
|
||||||
insert into demo (id) select generate_series(1, 5);
|
insert into demo (id) select generate_series(1, 5);
|
||||||
|
Loading…
Reference in New Issue
Block a user