summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2023-03-25 11:34:24 +0100
committerMaximilian Bosch <maximilian@mbosch.me>2023-03-29 08:39:47 +0200
commite2fb65175228a992f196f3b1700a53e18602e7f6 (patch)
tree201ddeb5f6f078b76152e10f226742ff494789b9 /nixos/modules/services
parenta5a715bb249ee4e531d7e743f5a4e4234dd29346 (diff)
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.
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/databases/postgresql.nix13
1 files changed, 11 insertions, 2 deletions
diff --git a/nixos/modules/services/databases/postgresql.nix b/nixos/modules/services/databases/postgresql.nix
index 16f76248b3a0..3d55995aba05 100644
--- a/nixos/modules/services/databases/postgresql.nix
+++ b/nixos/modules/services/databases/postgresql.nix
@@ -7,9 +7,18 @@ let
cfg = config.services.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 == []
- then cfg.package
- else cfg.package.withPackages (_: cfg.extraPlugins);
+ then base
+ else base.withPackages (_: cfg.extraPlugins);
toStr = value:
if true == value then "yes"