Updated Minecraf-Server Config
Some checks failed
/ Check Nix Flake (push) Failing after 31s

This commit is contained in:
Kaybee 2025-01-31 12:48:08 +01:00
parent 17fce87568
commit b122b41265
Signed by: kb01
SSH key fingerprint: SHA256:kF6CmkcOkKRzXK9JFMTQPK6b5gf5tHcJR1n2IS/Bj7M
4 changed files with 20 additions and 15 deletions

View file

@ -0,0 +1,10 @@
# Minecraft Server Configuration
Details about the Minecraft Module.
## Installation
1. Rebuild switch configuration
2. Create Database Structure
1. New Database `sudo mysql -u root < /run/secrets/rendered/minecraft/database/database-init.sql`
2. Restore Backup `sudo mysql -u root < path/to/backup.sql`

View file

@ -16,5 +16,12 @@ in
enable = true; enable = true;
settings.mysqld.port = 3459; settings.mysqld.port = 3459;
}; };
sops.secrets."minecraft/database/luckperms_password" = { sopsFile = ./secrets.yaml; };
sops.templates."minecraft/database/database-init.sql".content = ''
CREATE DATABASE 'luckperms';
CREATE USER 'luckperms'@'localhost';
GRANT ALL PRIVILEGES ON luckperms.* TO 'luckperms'@'localhost' IDENTIFIED BY '${config.sops.placeholder."minecraft/database/luckperms_password"}';
'';
# services.mysqlBackup.databases = [ "luckperms" ]; # Add Luckperms Database to Backups
}; };
} }

View file

@ -43,8 +43,7 @@ in
eula = true; eula = true;
}; };
# Create Secrets
sops.secrets."minecraft/database/luckperms_password" = { sopsFile = ./secrets.yaml; };
}; };
} }

View file

@ -64,20 +64,9 @@ in
data.address = "localhost:${toString config.services.mysql.settings.mysqld.port}"; data.address = "localhost:${toString config.services.mysql.settings.mysqld.port}";
data.database = "luckperms"; data.database = "luckperms";
data.username = "luckperms"; data.username = "luckperms";
data.password = builtins.readFile /run/secrets/minecraft/database/luckperms_password; data.password = builtins.readFile /run/secrets/minecraft/database/luckperms_password; # Secret created in ./database.nix
}; };
services.mysql = {
ensureDatabases = [ "luckperms" ];
ensureUsers = [
{
name = "luckperms";
ensurePermissions = {
"luckperms.*" = "ALL PRIVILEGES";
};
}
];
};
# services.mysqlBackup.databases = [ "luckperms" ]; # Add Luckperms Database to Backups
}; };
} }