Giter Club home page Giter Club logo

nix-minecraft's Introduction

nix-minecraft

About

nix-minecraft is an attempt to better package and support Minecraft as part of the Nix ecosystem, focusing on the server-side. As of currently, it packages:

  • All versions of Vanilla servers
  • All supported versions of the following mod/plugin loaders/servers:
    • Fabric
    • Legacy Fabric
    • Quilt
    • Paper
  • All supported versions of the following:
    • Velocity proxy
  • Various tools
    • nix-modrinth-prefetch
    • fetchPackwizModpack

Check out this video by vimjoyer that provides a brief overview of how to use the flake: https://youtu.be/Fph7SMldxpI

Changelog

See CHANGELOG.md.

Deprecation Policy

When something gets deprecated, an announcement gets added to the changelog file, and the respective parts in Nix get marked with an evaluation warning. Deprecated code is subject to removal after 1 month.

Installation

This repository is made exclusively as a Nix flake. Due to a lack of understanding of now Nix flake compat works, I have not included it, however if a PR is made to add compatibility, I may accept it.

In your flake.nix:

{
  inputs = {
    nix-minecraft.url = "github:Infinidoge/nix-minecraft";
  };
}

In your system configuration:

{ inputs, ... }: # Make sure the flake inputs are in your system's config
{
  imports = [ inputs.nix-minecraft.nixosModules.minecraft-servers ];
  nixpkgs.overlays = [ inputs.nix-minecraft.overlay ];
}

From there, you can setup the service or use the packages, as described below.

Roadmap

See TODO.md.

Packages

All of these are found under legacyPackages, since they are not derivations (i.e. an attrset of derivation, or a function that returns a derivation).

vanillaServers.*

Source

An attrset of all of the vanilla server versions, in the form of vanilla-version, where version is the Minecraft version (1.18, 1.12.2, 22w16b, etc), with all periods and spaces replaced with underscores (1_18, 1_12_2, etc).

For convenience, vanillaServers.vanilla is equivalent to the latest major version.

vanillaServers.vanilla-1_18_2
vanillaServers.vanilla-22w16b
vanillaServers.vanilla-22w13oneblockatatime

fabricServers.*

Source

An attrset of all of the Fabric server versions, in the form of fabric-mcversion, following the same format as described above for version numbers. The mcversion must be >=1.14. The Fabric version is the latest released version.

To change the Fabric version, you can override the derivation and set loaderVersion: fabric-mcversion.override { loaderVersion = "fabricversion"; }. The loaderVersion must be >=0.10.7.

For convenience, fabricServers.fabric is equivalent to the latest major Minecraft and Fabric versions.

fabricServers.fabric-1_18_2
fabricServers.fabric-22w16b
fabricServers.fabric-1_18_2.override { loaderVersion = "0.14.20"; } # Specific fabric loader version

quiltServers.*

Source

quiltServers functions the same as fabricServers, but with the Quilt mod loader.

legacyFabricServers.*

Source

legacyFabricServers functions the same as fabricServers, but with versions provided by the Legacy Fabric project.

Since Legacy Fabric does not have a defined newest version to target, it lacks a legacy-fabric attribute pointing to the latest version/loader version combination.

paperServers.*

Source

paperServers functions the same as fabricServers, but with the Paper server software.

If you plan on running paper without internet, you'll have to link the vanilla jar to cache/mojang_{version}.jar. The relevant jar is available at the package's vanillaJar attribute.

velocityServers.*

Source

An attrset of all of the Velocity server versions (differently from the others, the version does not include nor depend on specific minecraft versions).

For convenience, velocityServers.velocity is equivalent to the latest version.

minecraftServers.*

vanillaServers // fabricServers // quiltServers // legacyFabricServers // paperServers. Will be used most often as it contains all of the different server versions across each mod loader. When using the overlay, this will replace the Nixpkgs minecraftServers.

fetchPackwizModpack

Source

This function allows you to easily package a packwiz modpack, for example, to run it own your server. An example:

let
  modpack = pkgs.fetchPackwizModpack {
    url = "https://github.com/Misterio77/Modpack/raw/0.2.9/pack.toml";
    packHash = "sha256-L5RiSktqtSQBDecVfGj1iDaXV+E90zrNEcf4jtsg+wk=";
  };
in
{
  services.minecraft-servers.servers.cool-modpack = {
    enable = true;
    package = pkgs.fabricServers.fabric-1_18_2.override { loaderVersion = "0.14.9"; };
    symlinks = {
      "mods" = "${modpack}/mods";
    };
  };
}

This will symlink the modpack's final mods directory into the server's mods directory. You can also do this for config, or any files in the modpack you're interested in, in a granular way.

Note: Be sure to use a stable URL (e.g. a git tag/commit) to the manifest, as it changing will cause the derivation to generate a different hash, breaking the build until you change it.

The built modpack also exports a manifest attribute, that allows you to get any information from its pack.toml file, such as the MC or Modloader version. You can, this way, always sync the server's version with the one the modpack recommends:

let
  modpack = pkgs.fetchPackwizModpack {
    url = "https://github.com/Misterio77/Modpack/raw/0.2.9/pack.toml";
    packHash = "sha256-L5RiSktqtSQBDecVfGj1iDaXV+E90zrNEcf4jtsg+wk=";
  };
  mcVersion = modpack.manifest.versions.minecraft;
  fabricVersion = modpack.manifest.versions.fabric;
  serverVersion = lib.replaceStrings [ "." ] [ "_" ] "fabric-${mcVersion}";
in
{
  services.minecraft-servers.servers.cool-modpack = {
    enable = true;
    package = pkgs.fabricServers.${serverVersion}.override { loaderVersion = fabricVersion; };
    symlinks = {
      "mods" = "${modpack}/mods";
    };
  };
}

Note: Using manifest, by default, will cause IFD. If you want to avoid IFD while still having access to manifest, simply pass a manifestHash to the fetchPackwizModpack function, it will then fetch the manifest through builtins.fetchurl.

Additionally, you can override/add files (e.g. server-specific mods) on the pack through addFiles. For example:

let
  modpack = (pkgs.fetchPackwizModpack {
    url = "https://github.com/Misterio77/Modpack/raw/0.2.9/pack.toml";
    packHash = "sha256-L5RiSktqtSQBDecVfGj1iDaXV+E90zrNEcf4jtsg+wk=";
  }).addFiles {
    "mods/FabricProxy-lite.jar" = pkgs.fetchurl rec {
      pname = "FabricProxy-Lite";
      version = "1.1.6";
      url = "https://cdn.modrinth.com/data/8dI2tmqs/versions/v${version}/${pname}-${version}.jar";
      hash = "sha256-U+nXvILXlYdx0vgomVDkKxj0dGCtw60qW22EK4FhAJk=";
    };
  };
in

Others

All of these packages are also available under packages, not just legacyPackages.

  • vanilla-server: Same as vanillaServers.vanilla
  • fabric-server: Same as fabricServers.fabric
  • quilt-server: Same as quiltServers.quilt
  • paper-server: Same as paperServers.paper
  • velocity-server: Same as velocityServers.velocity
  • minecraft-server: Same as vanilla-server

nix-modrinth-prefetch

Source

A helper script to fetch a Modrinth mod, which outputs the necessary fetchurl invocation.

To use it, first find a mod on Modrinth, and click on the version you want. In the displayed information, there is a Version ID string. Click on it to copy the version ID. Then, run the script like so:

nix run github:Infinidoge/nix-minecraft#nix-modrinth-prefetch -- versionid

(This helper script can also be used in a temporary shell with nix shell github:Infinidoge/nix-minecraft#nix-modrinth-prefetch)

This fetchurl invocation directly fetches the mod, and can be copy-pasted to wherever necessary.

Modules

services.minecraft-servers

Source

Module for hosting multiple servers at once. All of the following are under this module.

enable

If enabled, the servers in services.minecraft-servers.servers will be created and started as applicable. The data for the servers will be loaded from and saved to dataDir, and any sockets will be put in runDir.

eula

Whether you agree to Mojang's EULA. This option must be set to true to run any Minecraft servers.

openFirewall

Whether to open ports in the firewall for each server. Sets the default for servers.<name>.openFirewall. This will only work if the ports are specified in servers.<name>.serverProperties, otherwise it will use the default ports. Remember to change the ports if you running multiple servers. The module asserts that servers with openFirewall set do not have conflicting ports to try to catch this.

dataDir

Directory to store the Minecraft servers. Defaults to /srv/minecraft.

Each server will be under a subdirectory named after the server name, such as /srv/minecraft/servername.

runDir

Directory to place the runtime tmux sockets into. Defaults to /run/minecraft. Each server's console will be a tmux socket file in the form of servername.sock. To connect to the console, run tmux -S /run/minecraft/servername.sock attach, press Ctrl + b then d to detach.

user

Name of the user to create and run servers under. It is recommended to leave this as the default, as it is the same user as services.minecraft-server.

group

Name of the group to create and run servers under. In order to modify the server files or attach to the tmux socket, your user must be a part of this group. It is recommended to leave this as the default, as it is the same group as services.minecraft-server.

environmentFile

File consisting of lines in the form varname=value to define environment variables for the minecraft servers. Secrets (database passwords, secret keys, etc.) can be substituted into server files without adding them to the Nix store by defining them in the environment file and adding them servers.<name>.files with the syntax @varname@.

servers.<name>

This family of options govern individual servers, which will be created on boot.

servers.<name>.enable

Whether to enable this server. If set to false, does NOT delete any data in the data directory, just does not generate the service file.

servers.<name>.autoStart

Whether to start this server on boot. If set to false, can still be started with systemctl start minecraft-server-servername. Requires the server to be enabled.

servers.<name>.openFirewall

Whether to open ports in the firewall for this server.

servers.<name>.restart

Value of systemd's Restart= service configuration option. Due to the servers being started in tmux sockets, values other than "no" and "always" may not work properly. As a consequence of the "always" option, stopping the server in-game with the /stop command will cause the server to automatically restart

To prevent infinite crash loops, there is a start limit of 5 times within 2 minutes.

servers.<name>.enableReload

Reload server when configuration changes instead of restarting. This re-links/copies the declared symlinks/files. You can include additional actions (even in-game commands) by setting <name>.extraReload.

servers.<name>.extraReload

Extra commands to run when reloading the service. Only has an effect if <name>.enableReload is true.

servers.<name>.whitelist

Whitelisted players, only has an effect when <name>.serverProperties.white-list = true;. When empty/unspecified, the whitelist file is not managed declaratively, allowing for use of the whitelist commands. Example:

{
  username1 = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
  username2 = "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy";
}

servers.<name>.serverProperties

Minecraft server properties for the server.properties file of this server. See The Documentation on these values. Example:

{
  server-port = 43000;
  difficulty = 3;
  gamemode = 1;
  max-players = 5;
  motd = "NixOS Minecraft server!";
  white-list = true;
  enable-rcon = true;
  "rcon.password" = "hunter2";
}

servers.<name>.package

The Minecraft server package to use. Example: pkgs.minecraftServers.vanilla-1_18_2

servers.<name>.jvmOpts

JVM Options for this server, usually used to set ram amount. Example: -Xms6144M -Xmx8192M

servers.<name>.symlinks

This option is special in that it allows for declarative management of arbitrary things inside of the server's folder. If the file already exists, existing one will have a .bak suffix added to it. If it is replaced again the previous backup will be overwritten.

How it works is that it takes an attrset of derivations, and symlinks each derivation into place with the name of the attribute in the attrset.

For example,

{
  symlinks = {
    text-file = pkgs.writeTextFile {
      name = "text-file";
      text = "Some text";
    };
  };
}

Would symlink a file containing "Some text" into the server's folder.

This option is quite powerful, and can be used for a number of things, though most notably it can be used for declaratively setting up mods or plugins for the server.

This example takes an attrset of the IDs and hashes for Modrinth mods, fetches each one, and makes a folder containing those mods. (linkFarmFromDrvs is quite useful because it can take a list of derivations and produce a folder suitable for this purpose.) The names in this attrset are meaningless, I only included them as convenient labels.

{
  symlinks = {
    mods = pkgs.linkFarmFromDrvs "mods" (builtins.attrValues {
      Starlight = fetchurl { url = "https://cdn.modrinth.com/data/H8CaAYZC/versions/XGIsoVGT/starlight-1.1.2%2Bfabric.dbc156f.jar"; sha512 = "6b0e363fc2d6cd2f73b466ab9ba4f16582bb079b8449b7f3ed6e11aa365734af66a9735a7203cf90f8bc9b24e7ce6409eb04d20f84e04c7c6b8e34f4cc8578bb"; };
      Lithium = fetchurl { url = "https://cdn.modrinth.com/data/gvQqBUqZ/versions/ZSNsJrPI/lithium-fabric-mc1.20.1-0.11.2.jar"; sha512 = "d1b5c90ba8b4879814df7fbf6e67412febbb2870e8131858c211130e9b5546e86b213b768b912fc7a2efa37831ad91caf28d6d71ba972274618ffd59937e5d0d"; };
      FerriteCore = fetchurl { url = "https://cdn.modrinth.com/data/uXXizFIs/versions/ULSumfl4/ferritecore-6.0.0-forge.jar"; sha512 = "e78ddd02cca0a4553eb135dbb3ec6cbc59200dd23febf3491d112c47a0b7e9fe2b97f97a3d43bb44d69f1a10aad01143dcd84dc575dfa5a9eaa315a3ec182b37"; };
      Krypton = fetchurl { url = "https://cdn.modrinth.com/data/fQEb0iXm/versions/jiDwS0W1/krypton-0.2.3.jar"; sha512 = "92b73a70737cfc1daebca211bd1525de7684b554be392714ee29cbd558f2a27a8bdda22accbe9176d6e531d74f9bf77798c28c3e8559c970f607422b6038bc9e"; };
      LazyDFU = fetchurl { url = "https://cdn.modrinth.com/data/hvFnDODi/versions/0.1.3/lazydfu-0.1.3.jar"; sha512 = "dc3766352c645f6da92b13000dffa80584ee58093c925c2154eb3c125a2b2f9a3af298202e2658b039c6ee41e81ca9a2e9d4b942561f7085239dd4421e0cce0a"; };
      C2ME = fetchurl { url = "https://cdn.modrinth.com/data/VSNURh3q/versions/t4juSkze/c2me-fabric-mc1.20.1-0.2.0%2Balpha.10.91.jar"; sha512 = "562c87a50f380c6cd7312f90b957f369625b3cf5f948e7bee286cd8075694a7206af4d0c8447879daa7a3bfe217c5092a7847247f0098cb1f5417e41c678f0c1"; };
    });
  };
}

servers.<name>.files

Things to copy into this server's data directory. Similar to symlinks, but these are actual files. Useful for configuration files that don't behave well when read-only.

nix-minecraft's People

Contributors

gabriel-doriath-dohler avatar h7x4 avatar hxr404 avatar infinidoge avatar jackwilsdon avatar leo60228 avatar mechan1sm avatar misterio77 avatar silveere avatar silverdev2482 avatar soupglasses avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nix-minecraft's Issues

nix flake show report error

$ nix flake show github:Infinidoge/nix-minecraft
github:Infinidoge/nix-minecraft/359e2a68e288fb467b38c0318236093411ee47f4
├───legacyPackages
│   ├───aarch64-darwin omitted (use '--legacy' to show)
│   ├───aarch64-linux omitted (use '--legacy' to show)
│   ├───i686-linux omitted (use '--legacy' to show)
│   ├───x86_64-darwin omitted (use '--legacy' to show)
│   └───x86_64-linux omitted (use '--legacy' to show)
├───lib: unknown
├───nixosModules
│   └───minecraft-servers: NixOS module
├───overlay: Nixpkgs overlay
└───packages
├───aarch64-darwin
trace: warning: `VelocityServers` from the `packages` flake output is deprecated. Please use the `legacyPackages` flake output instead.
error: attribute 'VelocityServers' missing

at /nix/store/a8axbx9xgz21cglwjwdx5jcmsf8i5dgp-source/flake.nix:68:12:

67|           )
68|           {
|            ^
69|             inherit (legacyPackages)
Did you mean velocityServers?

Add examples

Add examples of how to create a server and start it

Please use discussions when asking for help!

Hello! I have gone ahead and enabled discussions on this repository. If you are looking for help debugging a crashing issue, trying to do something with the module, or any other such questions, please use discussions instead of issues!

If you open an issue asking for help, I will likely convert it into a discussion!

Classpath broken on Fabric

Looks like fa037f4 makes Fabric Loader have two instances on the classpath at once, which is an illegal state. The server fails to start.

Stack trace for reference (fabric-1.20.1-0.15.11)
java.lang.IllegalStateException: trying to load net.fabricmc.loader.impl.FabricLoaderImpl from target class loader
        at net.fabricmc.loader.impl.util.LoaderUtil.verifyNotInTargetCl(LoaderUtil.java:55) ~[16h8ywfxn9dhw6mci6cz40yglyvp456r-fabric-loader-0.15.11.jar:?]
        at net.fabricmc.loader.impl.FabricLoaderImpl.<clinit>(FabricLoaderImpl.java:619) ~[16h8ywfxn9dhw6mci6cz40yglyvp456r-fabric-loader-0.15.11.jar:?]
        at net.fabricmc.loader.api.FabricLoader.getInstance(FabricLoader.java:42) ~[16h8ywfxn9dhw6mci6cz40yglyvp456r-fabric-loader-0.15.11.jar:?]
        at net.minecraft.class_6396.mdf82ea6$fabric-crash-report-info-v1$lambda$fillSystemDetails$0$1(class_6396.java:544) ~[server-intermediary.jar:?]
        at net.minecraft.class_6396.method_37123(class_6396.java:66) ~[server-intermediary.jar:?]
        at net.minecraft.class_6396.handler$zzm000$fabric-crash-report-info-v1$fillSystemDetails(class_6396.java:541) ~[server-intermediary.jar:?]
        at net.minecraft.class_6396.<init>(class_6396.java:58) ~[server-intermediary.jar:?]
        at net.minecraft.class_128.<init>(class_128.java:34) ~[server-intermediary.jar:?]
        at net.minecraft.class_128.method_24305(class_128.java:274) ~[server-intermediary.jar:?]
        at net.minecraft.server.Main.main(Main.java:102) ~[server-intermediary.jar:?]
        at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) ~[16h8ywfxn9dhw6mci6cz40yglyvp456r-fabric-loader-0.15.11.jar:?]
        ... 3 more

Only one tmux socket is accessible at a time

When running 2+ servers, only the most recently started server will have its associated tmux socket file work - the other will just say that there are no sessions:

$ doas systemctl restart minecraft-server-dark-firepit

$ doas tmux -S /run/minecraft/gbj.sock attach
no sessions

$ doas systemctl restart minecraft-server-gbj

$ doas tmux -S /run/minecraft/gbj.sock attach
<works perfectly fine>

Datapack Management not possible with Current Symlink Implementation

Problem: The folder for datapacks resides in /world/datapacks. Since the links created by with servers.<name>.symlinks results is defined to be the name of a variation and it is impossible to include special characters in the name of a derivation. My first immediate workaround trying create a symlink in the entire /worlds folder being a read only symbolic link to the nix store, thus making it impossible for the server to generate the world.

Fix: It would be nice to have a system for directly managing datapacks, or a modification to the current method of defining symlinks to get this to work. :)

Feature request: Minecraft launcher

I may be wrong, but this looks like it's only for Minecraft servers. I think it would be really cool to have something like PolyMC but declaratively configured in NixOS. So I can add all the mods and key-binds that I use in Minecraft to a config file and not have to manually change them every time I install Minecraft.

error: hash mismatch in fixed-output derivation

I have been trying to install mods for two days now, but I can't seem to get it right, so I ask here for help, because I don't have any ideas left.

Files

Steps I already did:

  • I first tried to do it locally, but that didn't work, so I made a github repository...
  • I did do packwiz refresh
  • I created the hash of the input by doing nix-prefetch-url --type sha256 https://raw.githubusercontent.com/Vartroc/hexamods/main/pack.toml and added the output to my url in my nix-minecraft module and the sha256- prefix.
  • I tried the nix-minecraft module without the mods part, there everything worked fine.

P.S: this issue was first a question, wheather I could fetch something locally, but because I don't have this question anymore (created a remote repo) and I now have another issue, that I didn't want to flood the issue thread with my issues, so I edited this one...

Hardcoded Implementation-Version in manifest

As described in fabric-servers/loader_locks, fabric-loader 0.16.0 uses ASM 9.6.

There is a code in mkTextileLoader.nix, that has hardcoded

Implementation-Version: 9.2

This causes some mods such as carpet-tis-addition for mc1.21 crash the server. (probably related to #79)

I already tested this with hardcoded

Implementation-Version: 9.6

and it didn't crash.

I'm not sure if hardcoding the Implementation-Version is a good idea.
Looks like it should be added into specific lock files.

Errors when starting server

Please help me I cant figure it out

code

{
pkgs,
lib,
...
}: let
modpack = pkgs.fetchPackwizModpack {
url = "https://github.com/Alpaca-Industries/iremia-comeback/raw/1.0.0/pack.toml";
packHash = "sha256-i+W0WA/eH/tNmYzguP2/v/rJb1LUnCV4WmMO9FpjcdI=";
};
mcVersion = modpack.manifest.versions.minecraft;
fabricVersion = modpack.manifest.versions.fabric;
serverVersion = lib.replaceStrings ["."] ["_"] "fabric-${mcVersion}";
in {
services.minecraft-servers.servers.iremia = {
enable = true;
autoStart = true;
package = pkgs.fabricServers.${serverVersion}.override {loaderVersion = fabricVersion;};

serverProperties = {
  server-port = 18611;
  /*
  difficulty = 3;
  gamemode = 1;
  max-players = 5;
  motd = "IREMIA!";
  white-list = false;
  */
  enable-rcon = true;
  "rcon.password" = "password";
};

symlinks = {
  "mods" = "${modpack}/mods";
  # "config" = "${modpack}/config";
};

};
}

errors:

Jun 30 15:28:01 greyserver wqnygk7snd6hzyswf2aigwv0pi6yazpn-minecraft-start-iremia[192689]: error connecting to /run/minecraft/iremia.sock (Permission denied)
Jun 30 15:28:01 greyserver wqnygk7snd6hzyswf2aigwv0pi6yazpn-minecraft-start-iremia[192690]: error connecting to /run/minecraft/iremia.sock (Permission denied)
Jun 30 15:28:01 greyserver systemd[1]: minecraft-server-iremia.service: Control process exited, code=exited, status=1/FAILURE`

× minecraft-server-iremia.service - Minecraft Server iremia
Loaded: loaded (/etc/systemd/system/minecraft-server-iremia.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Sun 2024-06-30 15:28:02 EDT; 5min ago
Process: 192667 ExecStartPre=/nix/store/zmf8qdrgvavixb95gfdf27957cai4560-unit-script-minecraft-server-iremia-pre-start/bin/minecraft-server-iremia-pre-start (code=exited, status=0/SUCC>
Process: 192682 ExecStart=/nix/store/wqnygk7snd6hzyswf2aigwv0pi6yazpn-minecraft-start-iremia (code=exited, status=1/FAILURE)
Process: 192692 ExecStopPost=/nix/store/bsw2fzdnqr6ihx1w96arv9f9252nj5qb-unit-script-minecraft-server-iremia-post-stop/bin/minecraft-server-iremia-post-stop (code=exited, status=0/SUCC>
IP: 0B in, 0B out
CPU: 89ms

Jun 30 15:28:02 greyserver systemd[1]: minecraft-server-iremia.service: Scheduled restart job, restart counter is at 5.
Jun 30 15:28:02 greyserver systemd[1]: minecraft-server-iremia.service: Start request repeated too quickly.
Jun 30 15:28:02 greyserver systemd[1]: minecraft-server-iremia.service: Failed with result 'exit-code'.
Jun 30 15:28:02 greyserver systemd[1]: Failed to start Minecraft Server iremia.`

Currently shipping broken fabric server derivations

Current broken fabric servers that i have found are all due to missing vanilla variants.

  • All combat versions.
  • All experimental-snapshot versions.
  • All deep-dark-expermimental-snapshot versions.

I would say we should look into seeing if whitelisting known minecraft versions for fabric in the update.py file. For example, i can currently find the pre, rc, oneblockatatime, Pre-Release, infinite in vanillaServers from a quick look over.

Feature Request: BTA (Betterthanadventure) & BTW (Betterthanwolves) Support

What are these?

BTA and BTW are both total conversion mods with the intention of going into a different direction than vanilla minecraft with many changes and different mechanics.

Actual Request:

I and my others would love the addition of BTA and BTW in the nix-minecraft project. Sadly, I don’t know much about nix packaging; therefore, this will be only a git issue.

[question] Interact with server

I am sorry if this is supposed to be common knowledge with NixOS or systemd, but I couldn't find any answers anywhere else.

How can I access the server log / run commands as the server? I couldn't find anything on how to do this.

When you normally run a Minecraft server (without services), it outputs all sorts of logs as the plugins load and as players join etc. and also allows running Minecraft commands from the terminal. I can't find this interface.

Help, please!

EDIT:
Oops, sorry. Just saw the thing saying to use discussions for help. I am converting it by closing it and reposting in discussions.

[Support] Configuration issues

I am not sure if I am doing something wrong here or this is an issue with the flake but I am getting this error
I also have a normal nixpkgs minecraft server running on this pc but I don't think it is causing this issue
Is this user error or a problem with the flake?

[root@Server:/etc/nixos]# ./update.sh 
warning: Git tree '/etc/nixos' is dirty
error:
       … while calling the 'seq' builtin

         at /nix/store/rj6pqzx66pliiwdfk2wjnnlk40rm3mpd-source/lib/modules.nix:320:18:

          319|         options = checked options;
          320|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          321|         _module = checked (config._module);

       … while evaluating a branch condition

         at /nix/store/rj6pqzx66pliiwdfk2wjnnlk40rm3mpd-source/lib/modules.nix:261:9:

          260|       checkUnmatched =
          261|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
             |         ^
          262|           let

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: infinite recursion encountered

       at /nix/store/rj6pqzx66pliiwdfk2wjnnlk40rm3mpd-source/lib/modules.nix:506:28:

          505|         builtins.addErrorContext (context name)
          506|           (args.${name} or config._module.args.${name})
             |                            ^
          507|       ) (lib.functionArgs f);

Here is the full log, abridged configuration.nix, and flake.nix
log.txt

{ config, pkgs, lib, inputs, ... }:
{
  imports = [ inputs.nix-minecraft.nixosModules.minecraft-servers ];
  nixpkgs.overlays = [ inputs.nix-minecraft.overlay ];
  services.minecraft-servers.survival-mods =
    let
      modpack = pkgs.fetchPackwizModpack {
        url = "https://github.com/Silverdev2482/Survival-mods";
        packHash = "1ml91nibaizymhiak7fwhb74wgn6x3j16fnqfarhh2nar9c62c53";
      };
      mcVersion = modpack.manifest.versions.minecraft;
      fabricVersion = modpack.manifest.versions.fabric;
      serverVersion = lib.replaceStrings [ "." ] [ "_" ] "fabric-${mcVersion}";
    in
    {
      enable = true;
      package = pkgs.fabricServers.${serverVersion}.override { loaderVersion = fabricVersion; };
      symlinks = {
        "mods" = "$modpack}/mods";
      };
    };
}
{
  description = "A very basic flake";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nix-minecraft.url = "github:Infinidoge/nix-minecraft";
  };

  outputs =
    { self
    , nixpkgs
    , ...
    }@inputs:
    let
      system = "x86_64-linux";
    in
    {
      formatter.${system} = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
      nixosConfigurations = {
        Server = nixpkgs.lib.nixosSystem {
          inherit system;
          specialArgs = inputs;
          modules = [
            ./hardware-configuration.nix
            ./configuration.nix
          ];
        };
      };
    };
}```

BetterMC2 [FABRIC] Modpack not running

Pretext:

I have the BetterMC modpack imported using packwiz curseforge import PATH and then did packwiz mr export in order to find out all the mods that packwiz couldn't download (It shows a list of the ones it couldn't download). Then I manually removed all the mods that couldn't be downloaded and uploaded the pack to github. Then I added the correct link and tried running it. But when the server starts, it gets a crashing loop and stops at the 5th crash (normal behaviour). I tried the packwiz modpack in a singleplayer world and everything worked fine... oh and the server works fine without, or just with a small amount of, mods

Questions:

Can I see the crashlogs anywhere? and
Do you have any idea why it crashes?

Modpack: https://github.com/Vartroc/bettermc/tree/main

Cannot launch server in safe mode

Since the server is currently launched through a script, which passes all of the arguments to Java instead of Minecraft, it is currently impossible to launch the game in safe mode.

Document how to change java package

Minecraft 1.20.5+ requires Java 21, but jre_headless in nixpkgs 23.11 is Java 19. This causes the server to fail to start with an error like

net/minecraft/bundler/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 63.0

This can be fixed by overriding the jre_headless input to the desired server package like

package = pkgs.fabricServers.fabric-1_20_6.override {
  jre_headless = pkgs.temurin-jre-bin-21;
};

Maybe this could be made more convenient with some kind of javaPackage option? Either way, it would be great to document a recommended approach.

I see that you probably already noticed some related issue here with d9ca459.

Quilt issue: quilt_loader missing

There seem to be an issue with the Quilt loader. Here is my config: https://github.com/sweenu/nixfiles/blob/d6fba43e8177dd67d9ba7ddb769fa934d8ebb4a2/hosts/najdorf/minecraft/default.nix
And here is the crash report: crash-2024-03-20_24.14.02.7060-quilt_loader.txt

I thought at first that it might be the modpack even though I have no problem using it client side. But then I tried removing all mods and keeping only the Quilt API mod and the error persisted. So I'm thinking that it might be an issue with the package.

Dynamic Environment Variables / Secret Management (with sops)

Hi! I'll start with stating my problem:

I am trying to configure rcon.password, setting its value via sops.
Sops requires you to read the secret at runtime, something like cat /path/to/secret
I've tried adding something along the lines of:

environmentFile = pkgs.writeText "test-file.txt" ''
	rconpwd=$(cat ${config.sops.secrets."minecraft-servers/vanilla-1/rcon-password".path})
'';

But I found out that this sets the respective systemd-setting, which does not interpolate the value and just returns $(cat <path>) as the actual string.

Am I missing another option or maybe another solution here that could work better, or do I need to manually override some settings here?

Code from nix-minecraft-servers

Hi there! I've deprecated my flake nix-minecraft-servers as I no longer want to continue maintaining it. I'm wondering if you'd like to take any code from it? I can see you already have most server packages, but there are a few proxies like Velocity and Waterfall that you are welcome to have.

Document that the module's `files` option does env substitution

Currently, neither the readme nor the option docs mention that services.minecraft-servers.servers.<name>.files performs environment substitution.

I just got bitten by this when working with binaries that were getting mysteriously corrupted, and the module mutating them was not something that I expected.

The ideal case scenario is IMHO that this is disabled by default and opt-in on each file, or at least opt-able out of, but it should really be documented. I can make a PR for either if it helps. 🙂

Tmux socket not accessible by members of the Minecraft group

After a relatively recent tmux update, it is no longer sufficient for the tmux socket to have rw permissions granted to the Minecraft group for access.

It seems like this will necessitate figuring out how to generate the relevant server-access command.

This seems to require searching through and finding all of the users of the group, checking if they're a member of the minecraft group, and including them?

Relevant tmux issue: tmux/tmux#3220

I suppose the module could instead be written to take in a list of users to be given the respective access permissions, but that feels weird.

Getting error when trying to set up datapack

Hello, I was trying to install a datapack as discussed in this issue.

The server starts normally without the symlink, but as soon as i add it, the server does not start and i get an error when checking the tmux socket.

config

      block-busters-1-21-test = {
        enable = true;
        package = inputs.minecraft-servers.legacyPackages.${system}.vanillaServers.vanilla-1_21;
        jvmOpts = "-Xms2G -Xmx8G";
        serverProperties = {
          server-ip = "0.0.0.0";
          enable-query = false;
          enable-jmx-monitoring = false;
          motd = "Block Busters";
          "query.port" = 25565;
          texture-pack = "";
          network-compression-threshold = 256;
          rate-limit = 0;
          max-tick-time = -1;
          require-resource-pack = false;
          resource-pack-sha1 = "";
          generator-settings = "";
          use-native-transport = true;
          enable-status = true;
          enable-command-block = false;
          gamemode = "survival";
          force-gamemode = false;
          level-name = "world";
          pvp = true;
          generate-structures = true;
          difficulty = "hard";
          max-players = 12;
          online-mode = true;
          allow-flight = false;
          view-distance = 18;
          max-build-height = 256;
          allow-nether = true;
          server-port = 25565;
          op-permission-level = 4;
          player-idle-timeout = 0;
          debug = false;
          hardcore = false;
          white-list = true;
          broadcast-console-to-ops = true;
          boradcast-rcon-to-ops = true;
          spawn-npcs = true;
          spawn-animals = true;
          snooper-enabled = true;
          text-filtering-config = "";
          function-permission-level = 2;
          level-type = "default";
          spawn-monsters = true;
          spawn-protection = 0;
          max-world-size = 29999984;
          sync-chunk-writes = true;
          prevent-proxy-connection = false;
          entity-broadcast-range-percentage = 100;
          level-seed = "2529419826";
          server-port = 25566;
        };

        symlinks = {
          "world/datapacks/Deactivate-Portals.zip" = pkgs.fetchurl {
            url = "https://cdn.modrinth.com/data/L83JDWD9/versions/bOGaf8Q5/Deactivate-Portals.zip";
            sha256 = "sha256-14sYSQAmixq1i6UP98eKQ4X5EqilQtWaFXKigsKERWw=";
          };
        };
      };

Error message:

[23:42:39] [ServerMain/WARN]: Did not find udev library in operating system. Some features may not work.

image

Use `/reload` instead of restarting service when changing some things in configuration

When changing whitelist or serverProperties, it is not always nice that the entire service restarts, since it disconnects all players. If you are only changing whitelist for example, the server could just be reloaded with the /reload command.

I am not quite sure how this would be implemented, but I know that the restartIfChanged option exists which could be set to false. I guess adding a ExecReload command to the service would be the first step to make this work.

[Feature Request] Configure nginx

it would be nice to have the option to set server..hostName = "minecraftserver1.example.com" and it would automatically configure nginx to proxypass that server.

Add a LICENCE file

Currently this repo is under an "All rights reserved" status where the distribution and use of this repo is disallowed due to copyright. Until this is addressed, technically nobody by law can use this code without your explicit written permission to do so.

I would recommend licensing this project under MIT or ISC, as this is what nixpkgs themselves uses.

Upstream to nixpkgs

What do you think about upstreaming this work to nixpkgs?
It would make it easier to discover this work, which isn't very visible currently.

Building fabric server fails

When trying to use fabric, im getting these errors:

~ sudo nixos-rebuild switch
building the system configuration...
error: builder for '/nix/store/c48jdsr11bgh4k0s4k266jjrnp4bp1s9-asm-9.6.zip.drv' failed with exit code 1;
       last 7 log lines:
       >
       > trying https://maven.fabricmc.net/org/ow2/asm/asm/9.6/asm-9.6.jar
       >   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
       >                                  Dload  Upload   Total   Spent    Left  Speed
       >   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
       > curl: (35) Recv failure: Connection reset by peer
       > error: cannot download asm-9.6.zip from any mirror
       For full logs, run 'nix log /nix/store/c48jdsr11bgh4k0s4k266jjrnp4bp1s9-asm-9.6.zip.drv'.
error: 1 dependencies of derivation '/nix/store/vkabcwh8ci8w53a6ixxcir5xpzgm7xls-fabric-server-launch.jar-fabric-0.16.2-1.21.1.drv' failed to build
...

Here is the part of the config:

      development_server = {
       enable = true;
       package = pkgs.fabricServers.fabric-1_21_1;

       serverProperties = {
         gamemode = 0;
         difficulty = 2;
         simulation-distance = 11;
         level-seed = 8;
         online-mode = false;
         white-list = false;
         server-port = 10000;
         jvmOpts = "-Xms4092M -Xmx4092M -XX:+UseG1GC";
       };
      };

I can download the file manually but when using nixos-rebuild switch it will fail.

Happy for any help on this!

Packwiz support

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.

Feature Request: Using the module without Tmux

Hi. First things first, thanks for your (and all the contributors') amazing work on this! I spent far too much time packaging various servers & proxies myself, and this project is going to make my life much easier. ❤️

I'd also love to migrate my ad-hoc solution to the provided module, but I don't really like the fact that it runs the server in a tmux session. I love Tmux as a terminal multiplexer, but using it for services has some really annoying problems that I don't think can be solved in any elegant way:

  • Logs don't end up in the system journal—this is probably the biggest one. This means that when something goes wrong and the service crashes, I am left without any information whatsoever unless it ends up in the server logs (which, e.g., startup script failures won't.). It also means I can't process the logs automatically via Loki, fail2ban, and other such tools.
  • The server can't be nicely automated from the outside. I really don't want to blindly pipe random keys into tmux and pray that they end up in the command prompt, not mixed with some other rubbish.
  • Connecting to the socket remotely is unnecessarily complicated.
  • Although not strictly forced by using tmux, I dislike having to run all servers under the same user. Ideally, I'd use systemd's DynamicUser for every server. Supporting this with Tmux would be fairly complicated.

A solution that I use currently, which has none of these problems, is to just run the server process directly, controlling it via RCON. It's not perfect, particularly because none of the RCON clients I could find are very nice, but I find it to be a much cleaner approach.

I'd love to add support for this workflow to the provided module, but I'm not sure whether such a PR would be accepted. If so, how do you think it should work? A global toggle? A per-server one? Something else? I'm open to all suggestions.

Thanks in advance!

EDIT: I just noticed #52, which addresses most of these issues. I guess I'll use the fork from there for now, and add support for multiple users after it lands.

Forge support

Hello, is there any plan to support the Forge loader?
Link: https://files.minecraftforge.net/net/minecraftforge/forge/

I am currently trying to fetch the libraries for the Forge loader to potentially add it to this repo. I have this simple script based on the fabric/update.py one.

Source of update.py
#!/usr/bin/env nix-shell
#!nix-shell -i python3.10 -p python310Packages.requests

import json
import subprocess
import requests
from pathlib import Path


def versiontuple(v):
    return tuple(map(int, (v.partition("+")[0].split("."))))


ENDPOINT = "https://raw.githubusercontent.com/PrismLauncher/meta-upstream/master/forge"


def get_versions():
    print("Fetching all versions")
    data = requests.get(f"{ENDPOINT}/promotions_slim.json").json()
    versions = []
    for key, loader_version in data["promos"].items():
        mc = key.split("-")[0]
        versions.append((mc, loader_version))
    return versions


def fetch_version(game_version, loader_version):
    """
    Return the server json for a given game and loader version
    """

    print(f"Fetch {ENDPOINT}/version_manifests/{game_version}-{loader_version}.json")
    return requests.get(
        f"{ENDPOINT}/version_manifests/{game_version}-{loader_version}.json"
    ).json()


def gen_locks(version, libraries):
    """
    Return the lock information for a given server json, returned in the format
    {
        "mainClass": string,
        "libraries": [
            {"name": string, "url": string, "sha256": string},
            ...
        ]
    }
    """
    print(version)
    ret = {"mainClass": version["mainClass"], "libraries": []}

    for library in version["libraries"]:
        name, url = library["name"], library["downloads"]["artifact"]["url"]

        if not name in libraries or any(not v for k, v in libraries[name].items()):
            print(f"- - - Fetching library {name}")
            ldir, lname, lversion = name.split(":")
            lfilename = f"{lname}-{lversion}.zip"
            # lurl = f"{url}{ldir.replace('.', '/')}/{lname}/{lversion}/{lname}-{lversion}.jar"
            if url == "":
                url = f"https://maven.minecraftforge.net/{ldir.replace('.','/')}/{lname}/{lversion}/{lname}-{lversion}.jar"

            lhash = subprocess.run(
                ["nix-prefetch-url", url], capture_output=True, encoding="UTF-8"
            ).stdout.rstrip("\n")

            libraries[name] = {"name": lfilename, "url": url, "sha256": lhash}
        else:
            pass
            # print(f"- - - Using cached library {name}")

        ret["libraries"].append(name)

    return ret


def main(versions, libraries, locks, lib_locks):
    """
    Fetch the relevant information and update the lockfiles.
    `versions` and `libraries` are data from the existing files, while
    `locks` and `lib_locks` are file objects to be written to
    """
    all_versions = get_versions()

    print("Starting fetch")
    try:
        for (game_version, loader_version) in all_versions:
            print(f"- Loader: {loader_version}")
            print(f"- - Game: {game_version}")
            if not versions.get(loader_version, None):
                versions[loader_version] = {}

            if not versions[loader_version].get(game_version, None):
                data = {}
                try:
                    data = fetch_version(game_version, loader_version)
                except json.JSONDecodeError:
                    versions.pop(loader_version, None)
                    continue
                versions[loader_version][game_version] = gen_locks(data, libraries)
            else:
                print(f"- - Game: {game_version}: Already locked")

    except KeyboardInterrupt:
        print("Cancelled fetching, writing and exiting")

    json.dump(versions, locks, indent=2)
    json.dump(libraries, lib_locks, indent=2)
    locks.write("\n")
    lib_locks.write("\n")


if __name__ == "__main__":
    folder = Path(__file__).parent
    lo = folder / "locks.json"
    li = folder / "libraries.json"
    lo.touch()
    li.touch()

    with (
        open(lo, "r") as locks,
        open(li, "r") as lib_locks,
    ):
        versions = {} if lo.stat().st_size == 0 else json.load(locks)
        libraries = {} if li.stat().st_size == 0 else json.load(lib_locks)

    with (
        open(lo, "w") as locks,
        open(li, "w") as lib_locks,
    ):
        main(versions, libraries, locks, lib_locks)

What I got with running it, after tweaking the loader.nix to change Main-Class, is this:

Error: Could not find or load main class net.minecraftforge.server.ServerMain
Caused by: java.lang.ClassNotFoundException: net.minecraftforge.server.ServerMain

Looking furthermore, it looks like forge doesn't expose the "base" library containing the boot code for the server.

I can try continuing, but I am no Java/Minecraft expert, so I will gladly take any help or a working solution!

Is this solely a packages repository?

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.

Feature Request: Allow adding to server PATH

I ran across a mod called Fastback which I want to use to make backups on my server. According to the developer it finds git in the $PATH, but I assume, probably because nixos trying to keep things pure it prevents certian applications from accessing the path, but I could be wrong. It uses git and native git is faster that the java implementation of it. in certain operations git is 35 times faster. Because of this I believe there should be a way for mods to use native programs. I also wonder if there should be a way for mods to use native libraries or can take advantage of them, I do not know if any mods do this however nor do I have examples. I have a few 3 ideas for solutions but I'm not sure if they would work.

  1. Simply have an option where mods can access the path. I assume this isn't pure and this seems like a hack but it would work.
  2. Have an option to install packages that would be accessible to the mods but other programs wouldn't be accessible to the mods. Seems like a good option but It doesn't solve libraries
  3. Have a method of packaging mods for nix. This doesn't seem like a good option for various reasons but if a few mods that require native libraries exist they could be packaged like this

Personally I would say do 1 or 2 and if mods that do require native libraries exist do 3, although that requires a lot of work.

Feature Request: Support for adding Java Agents

Add better support for java agents in the minecraft-servers module, such as in the form of

javaAgents = [ jar packages here ];

Which would get turned into -javaagent:${jar} -javaagent:${packages} -javaagent:${here} in the JVM arguments.

See #75

Allow the files option to accept directories

Forgive my ignorance if this isn't possible, but it would be nice if the files option could accept directories.

The symlinks option does not work for the config folder since it needs to be writable (this is mentioned in the files option docs). I'd rather not specify every config file individually in the files option 😂

Indescriptive error on port overlap assertion

There is an assertion set to prevent two servers from using the same port. However, a message is not set, producing a confusing error when the assertion is triggered:

error: attribute 'message' missing

       at /nix/store/369wr4laqdqzh5brq1g7nfc1pbfh23sn-source/nixos/modules/system/activation/top-level.nix:122:30:

          121|
          122|   failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
             |                              ^
          123|
(use '--show-trace' to show detailed location information)

[Support] I cannot get the create mod (nor betterEnd or anything to run)

my current config:

# minecraft servers
  services.minecraft-servers = {
    enable = true;
    eula = true;
    openFirewall = true;
    servers = {
      THISONEWONTWORK = {
        enable = true;
        autoStart = false; #systemctl start minecraft-server-testvan
        jvmOpts = "-Xmx512M";
        package = pkgs.fabricServers.fabric-1_20_1.override {
          # loaderVersion = "0.92.2";
          jre_headless = pkgs.jdk17;#pkgs.temurin-jre-bin-17; #wont change anything
        };
        serverProperties = {
          server-port = 25565;
          max-players = 10;
          motd = "Flieht ihr Narren!";
          enable-rcon = true;
          "rcon.port" = 25575;
          "rcon.password" = "-----";
          online-mode = false;
        };
        symlinks = {
          mods = with pkgs; linkFarmFromDrvs "mods"  (builtins.attrValues{
            FabricAPI = fetchurl { url = "https://github.com/FabricMC/fabric/releases/download/0.92.2%2B1.20.1/fabric-api-0.92.2+1.20.1.jar"; sha256 = "sha256-RQD4RMRVc9A51o05Y8mIWqnedxJnAhbgrT5d8WxncPw="; };
            # BetterEnd = fetchurl { url = "https://cdn.modrinth.com/data/gc8OEnCC/versions/7QwyTILr/better-end-4.0.11.jar"; sha256="sha256-KF/u5KJgKsZve02S8NlyrIcq7FE8K2Go9vRHyj3AhCA=";};
            Create = fetchurl { url = "https://cdn.modrinth.com/data/Xbc0uyRg/versions/h2HgGyvA/create-fabric-0.5.1-f-build.1417%2Bmc1.20.1.jar"; sha256="sha256-EahQ02ibR3HV+nBf+n3XEYJ8abcQgpVll+XQUUccwe4=";};
          });
        };
      };
    };
  };

The server seems to start reasonably fine with this log:

[18:35:31] [main/INFO]: Loading Minecraft 1.20.1 with Fabric Loader 0.15.11
[18:35:31] [main/INFO]: Loading 78 mods:
        - create 0.5.1-f-build.1417+mc1.20.1
           |-- com_electronwill_night-config_core 3.6.6
           |-- com_electronwill_night-config_toml 3.6.6
           |-- com_google_code_findbugs_jsr305 3.0.2
           |-- flywheel 0.6.10-2
           |-- forgeconfigapiport 8.0.0
           |-- milk 1.2.60
           |    \-- dripstone_fluid_lib 3.0.2
           |-- porting_lib_accessors 2.3.2+1.20.1
           |    \-- porting_lib_core 2.3.2+1.20.1
           |-- porting_lib_base 2.3.2+1.20.1
           |    |-- com_electronwill_night-config_core 3.6.6
           |    |-- com_electronwill_night-config_toml 3.6.6
           |    |-- porting_lib_attributes 2.3.2+1.20.1
           |    |-- porting_lib_common 2.3.2+1.20.1
           |    |-- porting_lib_config 2.3.2+1.20.1
           |    |-- porting_lib_core 2.3.2+1.20.1
           |    |-- porting_lib_fluids 2.3.2+1.20.1
           |    |-- porting_lib_lazy_registration 2.3.2+1.20.1
           |    |-- porting_lib_mixin_extensions 2.3.2+1.20.1
           |    |-- porting_lib_utility 2.3.2+1.20.1
           |    \-- reach-entity-attributes 2.4.0
           |-- porting_lib_brewing 2.3.2+1.20.1
           |    \-- porting_lib_core 2.3.2+1.20.1
           |-- porting_lib_client_events 2.3.2+1.20.1
           |    \-- porting_lib_core 2.3.2+1.20.1
           |-- porting_lib_entity 2.3.2+1.20.1
           |    |-- porting_lib_core 2.3.2+1.20.1
           |    \-- porting_lib_mixin_extensions 2.3.2+1.20.1
           |-- porting_lib_extensions 2.3.2+1.20.1
           |    |-- porting_lib_attributes 2.3.2+1.20.1
           |    |-- porting_lib_common 2.3.2+1.20.1
           |    |-- porting_lib_core 2.3.2+1.20.1
           |    \-- reach-entity-attributes 2.4.0
           |-- porting_lib_models 2.3.2+1.20.1
           |    |-- porting_lib_core 2.3.2+1.20.1
           |    |-- porting_lib_fluids 2.3.2+1.20.1
           |    \-- porting_lib_model_loader 2.3.2+1.20.1
           |-- porting_lib_networking 2.3.2+1.20.1
           |    \-- porting_lib_core 2.3.2+1.20.1
           |-- porting_lib_obj_loader 2.3.2+1.20.1
           |    |-- porting_lib_core 2.3.2+1.20.1
           |    \-- porting_lib_model_loader 2.3.2+1.20.1
           |-- porting_lib_tags 3.0
           |    \-- porting_lib_core 2.3.2+1.20.1
           |-- porting_lib_tool_actions 2.3.2+1.20.1
           |    \-- porting_lib_core 2.3.2+1.20.1
           |-- porting_lib_transfer 2.3.2+1.20.1
           |    |-- porting_lib_core 2.3.2+1.20.1
           |    \-- porting_lib_fluids 2.3.2+1.20.1
           |-- reach-entity-attributes 2.4.0
           \-- registrate-fabric 1.3.62-MC1.20.1
                |-- porting_lib_data 2.1.1090+1.20
                |    \-- porting_lib_gametest 2.1.1090+1.20
                \-- porting_lib_model_generators 2.1.1090+1.20
                     |-- porting_lib_gametest 2.1.1090+1.20
                     \-- porting_lib_model_materials 2.1.1090+1.20
        - fabric-api 0.92.2+1.20.1
           |-- fabric-api-base 0.4.31+1802ada577
           |-- fabric-api-lookup-api-v1 1.6.36+1802ada577
           |-- fabric-biome-api-v1 13.0.13+1802ada577
           |-- fabric-block-api-v1 1.0.11+1802ada577
           |-- fabric-block-view-api-v2 1.0.1+1802ada577
           |-- fabric-blockrenderlayer-v1 1.1.41+1802ada577
           |-- fabric-client-tags-api-v1 1.1.2+1802ada577
           |-- fabric-command-api-v1 1.2.34+f71b366f77
           |-- fabric-command-api-v2 2.2.13+1802ada577
           |-- fabric-commands-v0 0.2.51+df3654b377
           |-- fabric-containers-v0 0.1.64+df3654b377
           |-- fabric-content-registries-v0 4.0.11+1802ada577
           |-- fabric-convention-tags-v1 1.5.5+1802ada577
           |-- fabric-crash-report-info-v1 0.2.19+1802ada577
           |-- fabric-data-attachment-api-v1 1.0.0+de0fd6d177
           |-- fabric-data-generation-api-v1 12.3.4+1802ada577
           |-- fabric-dimensions-v1 2.1.54+1802ada577
           |-- fabric-entity-events-v1 1.6.0+1c78457f77
           |-- fabric-events-interaction-v0 0.6.2+1802ada577
           |-- fabric-events-lifecycle-v0 0.2.63+df3654b377
           |-- fabric-game-rule-api-v1 1.0.40+1802ada577
           |-- fabric-item-api-v1 2.1.28+1802ada577
           |-- fabric-item-group-api-v1 4.0.12+1802ada577
           |-- fabric-key-binding-api-v1 1.0.37+1802ada577
           |-- fabric-keybindings-v0 0.2.35+df3654b377
           |-- fabric-lifecycle-events-v1 2.2.22+1802ada577
           |-- fabric-loot-api-v2 1.2.1+1802ada577
           |-- fabric-loot-tables-v1 1.1.45+9e7660c677
           |-- fabric-message-api-v1 5.1.9+1802ada577
           |-- fabric-mining-level-api-v1 2.1.50+1802ada577
           |-- fabric-model-loading-api-v1 1.0.3+1802ada577
           |-- fabric-models-v0 0.4.2+9386d8a777
           |-- fabric-networking-api-v1 1.3.11+1802ada577
           |-- fabric-networking-v0 0.3.51+df3654b377
           |-- fabric-object-builder-api-v1 11.1.3+1802ada577
           |-- fabric-particles-v1 1.1.2+1802ada577
           |-- fabric-recipe-api-v1 1.0.21+1802ada577
           |-- fabric-registry-sync-v0 2.3.3+1802ada577
           |-- fabric-renderer-api-v1 3.2.1+1802ada577
           |-- fabric-renderer-indigo 1.5.2+85287f9f77
           |-- fabric-renderer-registries-v1 3.2.46+df3654b377
           |-- fabric-rendering-data-attachment-v1 0.3.37+92a0d36777
           |-- fabric-rendering-fluids-v1 3.0.28+1802ada577
           |-- fabric-rendering-v0 1.1.49+df3654b377
           |-- fabric-rendering-v1 3.0.8+1802ada577
           |-- fabric-resource-conditions-api-v1 2.3.8+1802ada577
           |-- fabric-resource-loader-v0 0.11.10+1802ada577
           |-- fabric-screen-api-v1 2.0.8+1802ada577
           |-- fabric-screen-handler-api-v1 1.3.30+1802ada577
           |-- fabric-sound-api-v1 1.0.13+1802ada577
           |-- fabric-transfer-api-v1 3.3.5+8dd72ea377
           \-- fabric-transitive-access-wideners-v1 4.3.1+1802ada577
        - fabricloader 0.15.11
           \-- mixinextras 0.3.5
        - java 17
        - minecraft 1.20.1
[18:35:31] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=file:/nix/store/rqfaqxk5hvzmbb4whw4b6fi5dzpxwniv-fabric-server-launch.jar-fabric-0.15.11-1.20.1 Service=Knot/Fabric Env=SERVER
[18:35:31] [main/INFO]: Compatibility level set to JAVA_17
[18:35:31] [main/WARN]: Error loading class: net/minecraft/class_906 (java.lang.ClassNotFoundException: net/minecraft/class_906)
[18:35:31] [main/WARN]: @Mixin target net.minecraft.class_906 was not found porting_lib_tool_actions.mixins.json:FishingHookRendererMixin from mod porting_lib_tool_actions
[18:35:31] [main/WARN]: Error loading class: net/minecraft/class_5616 (java.lang.ClassNotFoundException: net/minecraft/class_5616)
[18:35:31] [main/WARN]: @Mixin target net.minecraft.class_5616 was not found registrate-fabric.mixins.json:accessor.BlockEntityRenderersAccessor from mod registrate-fabric
[18:35:31] [main/INFO]: Initializing MixinExtras via com.llamalad7.mixinextras.service.MixinExtrasServiceImpl(version=0.3.5).
[18:35:33] [main/WARN]: @Inject(@At("INVOKE")) Shift.BY=2 on porting_lib_entity.mixins.json:common.LivingEntityMixin from mod porting_lib_entity::handler$znj000$porting_lib_entity$port_lib$onFinishUsing exceeds the maximum allowed value: 0. Increase the value of maxShiftBy to suppress this warning.
[18:35:37] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[18:35:38] [main/INFO]: [fabric-registry-sync] Loaded registry data [file 1/4]
[18:35:38] [main/INFO]: Loaded 22 recipes
[18:35:38] [main/INFO]: Loaded 2260 advancements
[18:35:39] [main/INFO]: Applied 106 biome modifications to 53 of 64 new biomes in 9.912 ms
[18:35:39] [Server thread/INFO]: Starting minecraft server version 1.20.1
[18:35:39] [Server thread/INFO]: Loading properties
[18:35:39] [Server thread/INFO]: Default game type: SURVIVAL
[18:35:39] [Server thread/INFO]: Generating keypair
[18:35:39] [Server thread/INFO]: Starting Minecraft server on *:25565
[18:35:39] [Server thread/INFO]: Using epoll channel type
[18:35:39] [Server thread/WARN]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[18:35:39] [Server thread/WARN]: The server will make no attempt to authenticate usernames. Beware.
[18:35:39] [Server thread/WARN]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
[18:35:39] [Server thread/WARN]: To change this, set "online-mode" to "true" in the server.properties file.
[18:35:39] [Server thread/INFO]: Preparing level "world"
[18:35:39] [Server thread/INFO]: Preparing start region for dimension minecraft:overworld

but pinging the server or joining results in a timeout. Removing the create mod makes it work

Add support for ignite

Ignite is a server mixin library comparable with paper and spigot. It would be cool to have a boolean option to enable it.

Move away from using digga

While digga is a nice all-whistles-included library, its absolutely huge. It is designed for managing your own NixOS dotfiles ant not so much for creating importable flake modules. So when you are creating a flake that is designed to be imported, you are indirectly putting this huge library on everyone who will import your library.

The non-digga solution would be to use nix flake's native outputs section to create a nixosModules and packages parts. If i get some time i may try to PR in this change myself.

This change would remove a whole 16 inputs
• Added input 'nix-minecraft':
    'github:Infinidoge/nix-minecraft/67d394fba0b7d4e04f12389bcff99abd51fa2b00' (2022-07-12)
• Added input 'nix-minecraft/digga':
    'github:divnix/digga/e2bb8ea28c5bbc7bb46ac91df3ac846ce9a3964c' (2022-04-06)
• Added input 'nix-minecraft/digga/blank':
    'github:divnix/blank/5a5d2684073d9f563072ed07c871d577a6c614a8' (2021-07-06)
• Added input 'nix-minecraft/digga/deploy':
    'github:serokell/deploy-rs/9a02de4373e0ec272d08a417b269a28ac8b961b4' (2021-09-28)
• Added input 'nix-minecraft/digga/deploy/flake-compat':
    'github:edolstra/flake-compat/12c64ca55c1014cdc1b16ed5a804aa8576601ff2' (2021-08-02)
• Added input 'nix-minecraft/digga/deploy/nixpkgs':
    follows 'nix-minecraft/digga/latest'
• Added input 'nix-minecraft/digga/deploy/utils':
    'github:numtide/flake-utils/74f7e4319258e287b0f9cb95426c9853b282730b' (2021-11-28)
• Added input 'nix-minecraft/digga/devshell':
    'github:numtide/devshell/0e56ef21ba1a717169953122c7415fa6a8cd2618' (2021-11-22)
• Added input 'nix-minecraft/digga/flake-compat':
    'github:edolstra/flake-compat/b7547d3eed6f32d06102ead8991ec52ab0a4f1a7' (2022-01-03)
• Added input 'nix-minecraft/digga/flake-utils-plus':
    'github:gytis-ivaskevicius/flake-utils-plus/be1be083af014720c14f3b574f57b6173b4915d0' (2021-12-13)
• Added input 'nix-minecraft/digga/flake-utils-plus/flake-utils':
    'github:numtide/flake-utils/74f7e4319258e287b0f9cb95426c9853b282730b' (2021-11-28)
• Added input 'nix-minecraft/digga/home-manager':
    'github:nix-community/home-manager/4daff26495ca9ac67476cba8cf15c3e36d91ab18' (2021-11-26)
• Added input 'nix-minecraft/digga/home-manager/nixpkgs':
    follows 'nix-minecraft/digga/nixlib'
• Added input 'nix-minecraft/digga/latest':
    'github:nixos/nixpkgs/8a308775674e178495767df90c419425474582a1' (2021-11-29)
• Added input 'nix-minecraft/digga/nixlib':
    follows 'nix-minecraft/nixpkgs'
• Added input 'nix-minecraft/digga/nixpkgs':
    follows 'nix-minecraft/nixpkgs'
• Added input 'nix-minecraft/nixpkgs':
    follows 'nixpkgs'
• Added input 'nix-minecraft/packwiz':
    'github:packwiz/packwiz/0d8c1762a373f9da9b14cb4b8156082bbbe14de8' (2022-06-20)

Allow duplicate ports when using multiple IP addresses

I see the code:

        {
          assertion =
            let
              serverPorts = mapAttrsToList
                (name: conf: conf.serverProperties.server-port or 25565)
                (filterAttrs (_: cfg: cfg.openFirewall) servers);

              counts = map (port: count (x: x == port) serverPorts) (unique serverPorts);
            in
            lib.all (x: x == 1) counts;
          message = "Multiple servers are set to use the same port. Change one to use a different port.";
        }

I haven't tested it, but this looks very much like you can't have multiple servers using the same server-port even if they have different server-ip values.

Or Maybe it just means you can't use openFirewall with such configs. Still trying to understand this logic.

Fabric 1.20.4 not working

Hey, I tried running a 1.20.4 fabric server and it doesn't seem to be working. I am getting this error:

Failed at step CHDIR spawning /nix/store/fxpm0mf2fj696b6b2p3i5qmlrx9gl27v-unit-script-minecraft-server-datapacktests-post-stop/bin/minecraft-server-datapacktests-post-stop

It seems this file is owned by root:root, which is why it says it doesn't exist.

Is anyone able to run a 1.20.4 fabric server? or is the issue only for me?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.