diff options
author | Jaakko Luttinen <jaakko.luttinen@iki.fi> | 2018-01-02 21:48:40 +0200 |
---|---|---|
committer | Robin Gloster <mail@glob.in> | 2018-01-05 14:47:54 +0100 |
commit | c26ff439055faacac38e66b62817c019c0711f0f (patch) | |
tree | 594b1a672a5db55e40354b8377bfe82fe26a9dc6 /nixos/modules | |
parent | 68855595cec81624bf3264c9adf55c5a5c8a328f (diff) |
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.
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/services/web-apps/tt-rss.nix | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/nixos/modules/services/web-apps/tt-rss.nix b/nixos/modules/services/web-apps/tt-rss.nix index df9ebf769c7c2..03565085da378 100644 --- a/nixos/modules/services/web-apps/tt-rss.nix +++ b/nixos/modules/services/web-apps/tt-rss.nix @@ -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"; |