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 8bc790171f 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.
This commit is contained in:
WilliButz 2024-05-02 18:19:20 +02:00
parent e9a0d0e62f
commit 47e376250e
No known key found for this signature in database
GPG key ID: AB05DF703EB9DC70

View file

@ -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;
})
];
}