diff --git a/modules/homelab/gameservers/minecraft_recpro/default.nix b/modules/homelab/gameservers/minecraft_recpro/default.nix index c5f7432..c5bec4b 100644 --- a/modules/homelab/gameservers/minecraft_recpro/default.nix +++ b/modules/homelab/gameservers/minecraft_recpro/default.nix @@ -82,10 +82,15 @@ in ensureUsers = [ { name = "minecraft_recpro"; - passwordFile = sec."minecraft_recpro_db_passwd".path; ensurePermissions = { "minecraft_recpro_db.*" = "ALL PRIVILEGES"; }; } ]; + initialScript = pkgs.writeText "minecraft_recpro-init.sql" '' + CREATE DATABASE IF NOT EXISTS minecraft_recpro_db; + CREATE USER IF NOT EXISTS 'minecraft_recpro'@'localhost' IDENTIFIED BY '${builtins.readFile /run/secrets/minecraft_recpro_db_passwd}'; + GRANT ALL PRIVILEGES ON minecraft_recpro.* TO 'minecraft_recpro'@'localhost'; + FLUSH PRIVILEGES; + ''; }; # open firewall