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>

Changed files
+2 -5
nixos
modules
services
web-apps
+2 -5
nixos/modules/services/web-apps/lemmy.nix
···
};
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)
{
···
};
});
-
services.postgresql = mkIf localPostgres {
enable = mkDefault true;
};
···
};
assertions = [{
-
assertion = cfg.database.createLocally -> localPostgres;
message = "if you want to create the database locally, you need to use a local database";
}];
···
};
config =
lib.mkIf cfg.enable {
services.lemmy.settings = (mapAttrs (name: mkDefault)
{
···
};
});
+
services.postgresql = mkIf cfg.database.createLocally {
enable = mkDefault true;
};
···
};
assertions = [{
+
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";
}];