nixos/lemmy: inline localPostgres into database assertion

Co-authored-by: Shahar Dawn Or <mightyiampresence@gmail.com>
Co-authored-by: Ctem <c@ctem.me>
Co-authored-by: a-kenji <aks.kenji@protonmail.com>
Co-authored-by: Brian Leung <leungbk@posteo.net>
Co-authored-by: Ilan Joselevich <personal@ilanjoselevich.com>
This commit is contained in:
Brian Leung
2022-09-21 09:00:52 -04:00
committed by Yt
co-authored by Shahar Dawn Or Ctem a-kenji Ilan Joselevich
parent 1d9d8a31bc
commit 3de898f262
+2 -5
View File
@@ -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";
}];