diff --git a/configurations/host/waffentrager/services/default.nix b/configurations/host/waffentrager/services/default.nix index b21cfea..b387f93 100644 --- a/configurations/host/waffentrager/services/default.nix +++ b/configurations/host/waffentrager/services/default.nix @@ -3,6 +3,8 @@ imports = [ ./elements.nix + ./postgresql.nix ]; waffentragerService.elements.enable = true; + waffentragerService.postgresql.enable = true; } \ No newline at end of file diff --git a/configurations/host/waffentrager/services/postgresql.nix b/configurations/host/waffentrager/services/postgresql.nix new file mode 100644 index 0000000..3c7f0bb --- /dev/null +++ b/configurations/host/waffentrager/services/postgresql.nix @@ -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"]; + }; + }; +}