nixos-config/configurations/host/waffentrager/services/postgresql.nix

29 lines
1.0 KiB
Nix
Raw Normal View History

2024-03-23 11:45:10 +01:00
{ materusArg, config, lib, pkgs, ... }:
{
options.waffentragerService.postgresql.enable = materusArg.pkgs.lib.mkBoolOpt false "Enable postgresql";
2024-03-23 12:39:23 +01:00
options.waffentragerService.postgresql.version = lib.mkOption { default = "16"; };
2024-03-23 11:45:10 +01:00
config =
let
cfg = config.waffentragerService.postgresql;
in
lib.mkIf cfg.enable {
waffentragerService.elements.enable = true;
services.postgresql.enable = true;
2024-03-23 12:39:23 +01:00
services.postgresql.package = pkgs."postgresql_${cfg.version}";
services.postgresql.dataDir = "${config.waffentragerService.elements.postgresqlDir}/${cfg.version}";
2024-03-26 10:21:50 +01:00
services.postgresql.enableJIT = true;
2024-03-28 19:41:57 +01:00
services.postgresql.authentication = pkgs.lib.mkOverride 10 ''
local all all trust
host all all 127.0.0.1/32 scram-sha-256
2024-07-13 19:02:17 +02:00
host all all ::1/128 scram-sha-256
2024-03-28 19:41:57 +01:00
'';
2024-03-23 11:45:10 +01:00
systemd.services.postgresql = {
partOf = [ "elements-mount.service" ];
requires = [ "elements-mount.service" ];
after = [ "elements-mount.service" ];
2024-03-23 11:45:10 +01:00
};
};
}