From d204976cce2c0dbbeb13e50871bb671847d7c2ec Mon Sep 17 00:00:00 2001 From: materus Date: Sat, 23 Mar 2024 11:45:10 +0100 Subject: [PATCH] waffentrager: add postgresql --- .../host/waffentrager/services/default.nix | 2 ++ .../host/waffentrager/services/postgresql.nix | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 configurations/host/waffentrager/services/postgresql.nix 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"]; + }; + }; +}