Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { pkgs, lib, config, ... }:
- let envConfig = config;
- in {
- config.services = let
- rathena-pkgs = import ./pkgs { };
- inherit (rathena-pkgs) rathena init-db dbScript;
- in {
- database = {
- nixos.useSystemd = true;
- nixos.configuration.services.mysql = {
- enable = true;
- port = 3306;
- initialScript = init-db;
- package = pkgs.mysql80;
- initialDatabases = [{ name = "rathena"; }];
- ensureDatabases = [ "rathena" ];
- configFile = pkgs.writeText "my.cnf" ''
- [mysqld]
- plugin-load-add=auth_socket.so
- '';
- ensureUsers = [{
- name = "rathena";
- ensurePermissions = { "rathena.*" = "ALL PRIVILEGES"; };
- }];
- };
- service.useHostStore = true;
- service.ports = [ "3306:3306" ];
- };
- game-server = with pkgs; {
- service.depends_on = [ "database" ];
- service.useHostStore = true;
- service.environment.PATH =
- "/bin:/usr/bin:${coreutils}/bin:${rathena}/bin:${nix}/bin:${bash}/bin";
- service.command = [
- "sh"
- "-c"
- ''
- cd ${rathena}/etc/rathena
- ${rathena}/bin/rathena start
- ${rathena}/bin/rathena watch
- ''
- ];
- service.volumes = [ "/tmp/log:/log" ];
- };
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment