From c26ff439055faacac38e66b62817c019c0711f0f Mon Sep 17 00:00:00 2001 From: Jaakko Luttinen Date: Tue, 2 Jan 2018 21:48:40 +0200 Subject: 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. --- nixos/modules/services/web-apps/tt-rss.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'nixos/modules/services/web-apps/tt-rss.nix') diff --git a/nixos/modules/services/web-apps/tt-rss.nix b/nixos/modules/services/web-apps/tt-rss.nix index df9ebf769c7..03565085da3 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"; -- cgit 1.4.1