mysql: Use ensure* options, split definition up into service files.

note/reason for split: nixos submodule option names aren't standardized...
This commit is contained in:
Kevin Baensch 2019-12-19 09:36:54 +01:00
parent 627a45c070
commit 92cd95d6ce
Signed by: derped
GPG key ID: C0F1D326C7626543
3 changed files with 56 additions and 45 deletions

View file

@ -3,9 +3,9 @@
with lib;
mkIf (elem "nextcloud" config.machine.services) {
services = let
cfg = config.machine;
domain = (findFirst (s: s.service == "nextcloud") cfg cfg.vHosts).domain;
services = let
cfg = config.machine;
domain = (findFirst (s: s.service == "nextcloud") cfg cfg.vHosts).domain;
in {
nextcloud = {
enable = true;
@ -47,5 +47,17 @@ mkIf (elem "nextcloud" config.machine.services) {
no-multicast-peers
'';
};
mysql = let
cfg = config.services.nextcloud.config;
in {
ensureDatabases = [ cfg.dbname ];
ensureUsers = [{
name = cfg.dbuser;
ensurePermissions = {
"${cfg.dbname}.*" = "ALL PRIVILEGES";
};
}];
};
};
}