Skip to content

Conversation

@aster-void
Copy link

@aster-void aster-void commented Sep 1, 2025

This PR adds a CLI Tool for managing and monitoring nix-minecraft servers.

closes #166

Features

feature description
list list available nix-minecraft instances
status [instance] show status of the instance
tail [instance] [-fF] [--retry] [-n length] tail the log of the instance
send [instance] [command] send command to the instance
reload [instance] send reload command to the instance
start [instance] start the instance
stop [instance] stop the instance
restart [instance] restart the instance
uuid [player] (utility) fetches UUID of the player

System Expectation

it expects:

  • env NIX_MINECRAFT_MINECRAFTCTL_FILE to be set to the path to the file below
  • file minecraftctl.json that describes nix-minecraft configuration. see spec.md for expected formatting.

@aster-void aster-void force-pushed the feat/minecraftctl branch 5 times, most recently from 9482333 to adf430f Compare September 2, 2025 09:21
Copy link
Owner

@Infinidoge Infinidoge left a comment

Choose a reason for hiding this comment

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

I'm not personally sure if a minecraftctl is within scope for nix-minecraft, so I'm not sure if this will be accepted as a feature in general. If there are examples of management interfaces like this in Nixpkgs, please let me know where.

With regards to the implementation itself:

  • Avoid relying on and parsing names as "canonical" information. Instead, add needed metadata to the packages themselves. getPackageInfo should be replaced with relevant metadata in passthru on the original derivations.
  • I really do not think bash is the right language for this. I will grant, this is in part due to my dislike of anything moderately complex being written in bash. Needing to reinvent several wheels is... not great.
  • Instead of using an environment variable, create a symlink in /run/minecraft/servers.json as a static path. Since this requires a rebuild anyways,
  • I don't think this needs a spec.

@aster-void
Copy link
Author

@Infinidoge
Thank you for the review!

I found this as an example of adding a CLI helper for easier maintenance:

https://search.nixos.org/options?channel=unstable&show=services.borgbackup.jobs

Adding a job will cause a borg-job-NAME wrapper to be added to your system path, so that you can perform maintenance easily. See also the chapter about BorgBackup in the NixOS manual.

as well as agenix (although agenix is not in nixpkgs).

For the implementation part, I'm rewriting it in python.

@aster-void aster-void marked this pull request as draft September 9, 2025 19:04
@aster-void aster-void force-pushed the feat/minecraftctl branch 2 times, most recently from fbc1219 to 87b2b63 Compare September 11, 2025 05:15
@aster-void aster-void marked this pull request as ready for review September 11, 2025 05:17
@aster-void aster-void marked this pull request as draft September 11, 2025 06:00
@aster-void aster-void marked this pull request as ready for review September 11, 2025 13:27
@aster-void
Copy link
Author

I think it's ready for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI for interacting with the server

2 participants