This commit is contained in:
parent
17fce87568
commit
b122b41265
4 changed files with 20 additions and 15 deletions
10
modules/nixos/services/minecraft/README.md
Normal file
10
modules/nixos/services/minecraft/README.md
Normal 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`
|
|
@ -16,5 +16,12 @@ in
|
|||
enable = true;
|
||||
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
|
||||
};
|
||||
}
|
||||
|
|
|
@ -43,8 +43,7 @@ in
|
|||
eula = true;
|
||||
};
|
||||
|
||||
# Create Secrets
|
||||
sops.secrets."minecraft/database/luckperms_password" = { sopsFile = ./secrets.yaml; };
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -64,20 +64,9 @@ in
|
|||
data.address = "localhost:${toString config.services.mysql.settings.mysqld.port}";
|
||||
data.database = "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
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue