1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 14:11:36 +00:00

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:
Jaakko Luttinen 2018-01-02 21:48:40 +02:00 committed by Robin Gloster
parent 68855595ce
commit c26ff43905

View file

@ -557,6 +557,20 @@ let
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") {
extraUsers = singleton {
name = "tt_rss";