Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/mindustry: init #85634

Closed
wants to merge 1 commit into from
Closed

nixos/mindustry: init #85634

wants to merge 1 commit into from

Conversation

Oro
Copy link
Contributor

@Oro Oro commented Apr 20, 2020

Motivation for this change

To host a Mindustry server on NixOS via services configuration.
Note that mindustry can open up a socket connection when setup via e.g.

      services.mindustry = {
        enable = true;
        extraConfig.socketInput = true;
      };

This can then be used to send commands to the server (it only listens on localhost) with e.g. nc

echo "shuffle" | nc -w1 127.0.0.1 6859

I am not 100% happy with that, if anyone has gotten some ideas I'd be glad to hear them.

Also, I am not sure how I would be able to implement a graceful shutdown of mindustry-server, again feedback welcome.

CC: @fgaz maintainer of pkgs.mindustry

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing this service! I have a few suggestions which I hope are helpful.

The map that mindustry-server should host. Leaving both game-mode and game-map empty results in a random survival map.
'';
};
stateDirName = mkOption {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this uses DynamicUser this option didn't seem very useful. I would recommend simply hard coding to /var/lib/mindustry.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, thanks! Might make more sense if we also allow mods and maps to be included later on, but not currently as far as I can tell.

socketInput = true;
};
description = ''
Extra game configuration passed to mindustry-server via the config argument.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A link to configuration options would be great here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, I have created an issue upstream at https://github.com/MindustryGame/wiki/issues/41. In the meantime I have appended the description string how to get available options.

default = [ ];
example = [ "playerlimit 8" "reloadmaps" ];
description = ''
Extra commands passed to mindustry-server.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A link to command options would be great here.

Copy link
Contributor Author

@Oro Oro May 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See extraConfig

options = {
services.mindustry = {
enable = mkEnableOption name;
package = mkOption {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any variants of this package that make this option especially convenient?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there's the version whitelist override, which is a compile-time option

Copy link
Member

@fgaz fgaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be cool to have maps and mods options of type list of paths. Then we could package the best ones in an overlay.

But this would require separating the mods and maps directories from the stateDir (hoping the server doesn't somehow need write access to them)

Edit: shouldn't there be a meta.maintainers in the module too?

@Oro
Copy link
Contributor Author

Oro commented May 9, 2020

maps and mods would be awesome. Might make more sense in a separate PR though, as I have no idea how the server behaves there yet.
meta.maintainers thanks, added.

@stale
Copy link

stale bot commented Nov 5, 2020

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 5, 2020
Comment on lines +23 to +24
'';

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'';
'';

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Nov 24, 2020
@Oro
Copy link
Contributor Author

Oro commented Jan 7, 2021

I am no longer hosting a Mindustry server, if anyone wants to pick this one up this please feel free to do so.

@Oro Oro closed this Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants