You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
706 B

{ pkgs, ... }:
{
networking.firewall.allowedTCPPorts = [ 3306 ];
services.mysql = {
enable = true;
package = pkgs.mariadb;
ensureDatabases = [ "monica" ];
ensureUsers = [
{
name = "monica";
ensurePermissions = {
"monica.*" = "ALL PRIVILEGES";
};
}
];
};
systemd.services.mysql-config = {
enable = true;
path = [ pkgs.mysql ];
requiredBy = [ "multi-user.target" ];
after = [ "mysql.service" ];
serviceConfig = {
Type = "simple";
User = "mysql";
Group = "mysql";
RuntimeDirectory = "mysql-config";
};
script = ''
set -e
mysql < /etc/nixos/mysql-config
'';
};
}