From 3de898f26272c261b4e186bc8744080e22019068 Mon Sep 17 00:00:00 2001 From: Brian Leung Date: Fri, 16 Sep 2022 00:28:29 -0700 Subject: [PATCH] nixos/lemmy: inline localPostgres into database assertion Co-authored-by: Shahar Dawn Or Co-authored-by: Ctem Co-authored-by: a-kenji Co-authored-by: Brian Leung Co-authored-by: Ilan Joselevich --- nixos/modules/services/web-apps/lemmy.nix | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/nixos/modules/services/web-apps/lemmy.nix b/nixos/modules/services/web-apps/lemmy.nix index 925156e7c4a..24ba91df614 100644 --- a/nixos/modules/services/web-apps/lemmy.nix +++ b/nixos/modules/services/web-apps/lemmy.nix @@ -71,9 +71,6 @@ in }; config = - let - localPostgres = (cfg.settings.database.host == "localhost" || cfg.settings.database.host == "/run/postgresql"); - in lib.mkIf cfg.enable { services.lemmy.settings = (mapAttrs (name: mkDefault) { @@ -100,7 +97,7 @@ in }; }); - services.postgresql = mkIf localPostgres { + services.postgresql = mkIf cfg.database.createLocally { enable = mkDefault true; }; @@ -141,7 +138,7 @@ in }; assertions = [{ - assertion = cfg.database.createLocally -> localPostgres; + assertion = cfg.database.createLocally -> cfg.settings.database.host == "localhost" || cfg.settings.database.host == "/run/postgresql"; message = "if you want to create the database locally, you need to use a local database"; }];