modules: services: add postgresql

Enable the service itself in other modules when needed, but pin the
package in a single place.
This commit is contained in:
Bruno BELANYI 2021-07-29 12:05:51 +02:00
parent 820b52314f
commit 9f00d8a38e
4 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,18 @@
{ config, lib, pkgs, ... }:
let
cfg = config.my.services.postgresql;
in
{
options.my.services.postgresql = with lib; {
enable = my.mkDisableOption "postgres configuration";
};
config = lib.mkMerge [
# Let other services enable postgres when they need it
(lib.mkIf cfg.enable {
services.postgresql = {
package = pkgs.postgresql_12;
};
})
];
}