Closed mainrs closed 1 year ago
There actually already is a module!
Right now it's mainly for configuring multiple servers, as opposed to the single-server module in Nixpkgs, however it does also have support for including arbitrary files in the server directory. I personally use the module for managing multiple modded Fabric/Quilt servers, though I've been meaning to rewrite it since it's not designed the best as of right now.
I was thinking about something like this:
services.moddedMinecraft = {
enable = true;
modloader = "fabric"; # or maybe { name = "fabric"; version = "<default latest>"; }'
mods = [
{ platform = "modrinth"; id = "..."; }
{ platform = "curseforge"; id = "..."; }
];
config = {}; # server.properties.
};
Like a generic way to configure it. For those that do not really care about more granular details like configuration files or other features.
Unfortunately with regards to the mods = []
option, there isn't a way to implement that in a way which preserves the pure evaluation of Nix, and breaking that is a non-starter.
For Modrinth in particular, you can see my attempt of making a system for that in the fetchModrinthMod
helper, however that has its own issues.
(Primarily in that it needs to rerun the API request semi-regularly since that is how it gets the file URL)
In addition, CurseForge's API is really bad, and a number of mod authors have opted-out of being accessible to the API at all, making it a patchwork solution at best.
With regards to the modloader = ...;
, this is pretty simply accomplished with the package = ...;
option already present:
package = pkgs.minecraftServers.fabric-server;
# Automatically latest Minecraft version
# Use fabric-1_19_2 for a specific version.
as an example.
Something I may do is add a simple mods = [];
option which lets you put in derivations (like fetchurl
, etc) to mods and combines them all together for you. Instead of needing to do something like
symlinks = {
mods = pkgs.linkFarmFromDrvs "mods" [
(fetchurl { url = ...; sha256 = ...; })
];
};
You'd instead do
mods = [
(fetchurl { url = ...; sha256 = ...; })
];
As another option for mod management, see #12 for discussion on supporting Packwiz, which is a modpack management tool.
I do very much agree that a simpler to use interface would be much nicer, however it unfortunately just isn't possible within Nix while keeping pure evaluation (and avoiding extraneous API requests). I'm open to ideas, though.
Thanks for the follow up. The very fact that this flake manages an index for all available versions is already helpful enough! Stuff like this can even be out-sourced into a second flake that is more tailored for modpack/game instance management. Which would include config files and the likes.
Or are there plans to include an abstract (moddable) minecraft module where one can configure server properties, mods, datapacks and the likes?
As of now, the scope seems to only include the derivations themselves and nothing else.