From 47e376250e506de980b30d3fcb61560bfbc81fe2 Mon Sep 17 00:00:00 2001 From: WilliButz Date: Thu, 2 May 2024 18:19:20 +0200 Subject: [PATCH] module: increase priority for posgresql package default This gives the default value from this module a slightly higher priority than the upstream module's default, while still allowing users to simply set `services.postgresql.package` using the default priority. The change in 8bc790171faecb5da81a8ab45e5489ab6a288e72 introduced `mkDefault` for the postgresql package. Unfortunately the upstream package option default is also specified using `mkDefault` instead of the more appropriate `mkOptionDefault`. This meant that users with a `system.stateVersion` other than `22.05`, `22.11` or `23.05` got an evaluation error because there are two conflicting definitions for the package option. --- module.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/module.nix b/module.nix index 112a925..e2994ce 100644 --- a/module.nix +++ b/module.nix @@ -19,7 +19,8 @@ let inherit (lib.modules) mkDefault mkIf - mkMerge; + mkMerge + mkOverride; inherit (lib.options) mdDoc @@ -354,7 +355,12 @@ in # # After postgresql_14 has been removed from nixpkgs, this workaround can be dropped. (mkIf (versionOlder config.system.stateVersion "24.05") { - services.postgresql.package = lib.mkDefault pkgs.postgresql_14; + # The upstream postgresl module is using mkDefault + # to specify the default value for the package option. + # Unfortunately this forces us to specify this default with + # a higher priority, i.e. lower number, than mkDefault which + # has priority 1000 + services.postgresql.package = mkOverride 999 pkgs.postgresql_14; }) ]; }