waffentrager: add postgresql

This commit is contained in:
Mateusz Słodkowicz 2024-03-23 11:45:10 +01:00
parent c47555fec7
commit d204976cce
Signed by: materus
GPG Key ID: 28D140BCA60B4FD1
2 changed files with 24 additions and 0 deletions

View File

@ -3,6 +3,8 @@
imports =
[
./elements.nix
./postgresql.nix
];
waffentragerService.elements.enable = true;
waffentragerService.postgresql.enable = true;
}

View File

@ -0,0 +1,22 @@
{ materusArg, config, lib, pkgs, ... }:
{
options.waffentragerService.postgresql.enable = materusArg.pkgs.lib.mkBoolOpt false "Enable postgresql";
config =
let
cfg = config.waffentragerService.postgresql;
in
lib.mkIf cfg.enable {
waffentragerService.elements.enable = true;
services.postgresql.enable = true;
services.postgresql.package = pkgs.postgresql_16;
services.postgresql.dataDir = "${config.waffentragerService.elements.path}/services/postgresql";
systemd.services.postgresql = {
partOf = ["elements-mount.service"];
requires = ["elements-mount.service"];
after = ["elements-mount.service"];
};
};
}