Guest User

Untitled

a guest
Oct 7th, 2020
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. { pkgs, lib, config, ... }:
  2. let envConfig = config;
  3. in {
  4. config.services = let
  5. rathena-pkgs = import ./pkgs { };
  6. inherit (rathena-pkgs) rathena init-db dbScript;
  7. in {
  8. database = {
  9. nixos.useSystemd = true;
  10. nixos.configuration.services.mysql = {
  11. enable = true;
  12. port = 3306;
  13. initialScript = init-db;
  14. package = pkgs.mysql80;
  15. initialDatabases = [{ name = "rathena"; }];
  16. ensureDatabases = [ "rathena" ];
  17. configFile = pkgs.writeText "my.cnf" ''
  18. [mysqld]
  19. plugin-load-add=auth_socket.so
  20. '';
  21. ensureUsers = [{
  22. name = "rathena";
  23. ensurePermissions = { "rathena.*" = "ALL PRIVILEGES"; };
  24. }];
  25. };
  26. service.useHostStore = true;
  27. service.ports = [ "3306:3306" ];
  28. };
  29.  
  30. game-server = with pkgs; {
  31. service.depends_on = [ "database" ];
  32. service.useHostStore = true;
  33. service.environment.PATH =
  34. "/bin:/usr/bin:${coreutils}/bin:${rathena}/bin:${nix}/bin:${bash}/bin";
  35. service.command = [
  36. "sh"
  37. "-c"
  38. ''
  39. cd ${rathena}/etc/rathena
  40. ${rathena}/bin/rathena start
  41. ${rathena}/bin/rathena watch
  42. ''
  43. ];
  44. service.volumes = [ "/tmp/log:/log" ];
  45. };
  46. };
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment