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:
parent
1d9d8a31bc
commit
3de898f262
|
@ -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";
|
||||
}];
|
||||
|
||||
|
|
Loading…
Reference in a new issue