nixos/service.tt-rss: improve mysql automatic setup
If the user chooses MySQL, it is enabled by default. Also, the used database is created automatically along with the user and permissions.
This commit is contained in:
parent
68855595ce
commit
c26ff43905
@ -557,6 +557,20 @@ let
|
|||||||
after = ["network.target" "${dbService}"];
|
after = ["network.target" "${dbService}"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.mysql = optionalAttrs (cfg.database.type == "mysql") {
|
||||||
|
enable = true;
|
||||||
|
package = mkDefault pkgs.mariadb;
|
||||||
|
ensureDatabases = [ cfg.database.name ];
|
||||||
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = cfg.user;
|
||||||
|
ensurePermissions = {
|
||||||
|
"${cfg.database.name}.*" = "ALL PRIVILEGES";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
users = optionalAttrs (cfg.user == "tt_rss") {
|
users = optionalAttrs (cfg.user == "tt_rss") {
|
||||||
extraUsers = singleton {
|
extraUsers = singleton {
|
||||||
name = "tt_rss";
|
name = "tt_rss";
|
||||||
|
Loading…
Reference in New Issue
Block a user