Infinidoge / nix-minecraft

An attempt to better support Minecraft-related content for the Nix ecosystem
MIT License
246 stars 26 forks source link

Packwiz support #12

Closed oatmealine closed 1 year ago

oatmealine commented 2 years ago

Packwiz support would be greatly appreciated, as manually fetching every mod through fetchModrinth isn't the best - I'd really like being able to point it at a pack.toml URL and have it download the bootstrapper, run it, etc. all on its own.

soupglasses commented 2 years ago

I am currently working on packwiz2nix tooling for this exact use-case. Its not yet published but will be soon.

For now you could use the imperative way of adding packwiz-installer-bootstrap to your minecraft server root (/var/lib/minecraft/), then inside your NixOS configuration add a ExecStartPre to your systemd service file similar to whats described in its tutorial:

java -jar packwiz-installer-bootstrap.jar -g -s server https://[your-server]/pack.toml

oatmealine commented 1 year ago

As an alternative, unsup has worked quite well for me and supports the Packwiz format:

let
  # https://git.sleeping.town/unascribed/unsup/releases
  unsup = pkgs.fetchurl {
    url = "https://git.sleeping.town/attachments/c521d178-8938-40a5-b21b-0333eef4099e";
    sha256 = "c5bd49784392b651e4bc71fe57976f5b4fb14f09e0e23183ae5b94a821ae4756";
  };
  packLocation = "https://example.com/pack.toml";
  unsupIni = ''
    version=1
    preset=minecraft

    source_format=packwiz
    source=${packLocation}

    force_env=server
    no_gui=true

    [flavors]
    shaders=no_shaders
  '';
in {
  # ...
  symlinks = {
    "unsup.ini" = pkgs.writeTextFile {
      name = "unsup.ini";
      text = unsupIni;
    };
  };
  jvmOpts = "-Xmx4G -javaagent:${unsup}"
}
Infinidoge commented 1 year ago

If fetchPackwizModpack isn't sufficient, this issue can be reopened if necessary.