mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 05:05:29 +03:00
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
1 changed files with 2 additions and 5 deletions
|
@ -71,9 +71,6 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config =
|
||||||
let
|
|
||||||
localPostgres = (cfg.settings.database.host == "localhost" || cfg.settings.database.host == "/run/postgresql");
|
|
||||||
in
|
|
||||||
lib.mkIf cfg.enable {
|
lib.mkIf cfg.enable {
|
||||||
services.lemmy.settings = (mapAttrs (name: mkDefault)
|
services.lemmy.settings = (mapAttrs (name: mkDefault)
|
||||||
{
|
{
|
||||||
|
@ -100,7 +97,7 @@ in
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
services.postgresql = mkIf localPostgres {
|
services.postgresql = mkIf cfg.database.createLocally {
|
||||||
enable = mkDefault true;
|
enable = mkDefault true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -141,7 +138,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
assertions = [{
|
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";
|
message = "if you want to create the database locally, you need to use a local database";
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue