A modular, flake-based Paper Minecraft server for NixOS: declarative plugins, scheduled backups, systemd sandboxing, and Prometheus monitoring
- each as its own toggleable module. See
docs/ARCHITECTURE.mdfor the full design rationale.
-
Pin a real Paper build. Edit
pkgs/paper.nix's defaults (or thecallPackagecall inexample/configuration.nix) with a realmcVersion/build/sha256. Get the hash with:nix-prefetch-url https://api.papermc.io/v2/projects/paper/versions/<mcVersion>/builds/<build>/downloads/paper-<mcVersion>-<build>.jar -
Fill in plugin hashes. Every
sha256 = lib.fakeSha256;inplugins/sources.nixneeds a real hash fromnix-prefetch-url, or swap in the plugins you actually want. -
Set up the RCON secret. This project refuses to let you put the RCON password in
serverProperties(it would land in the world- readable Nix store). Using agenix:nix run github:ryantm/agenix -- -e secrets/rcon-password.ageand point
age.secrets.mc-rcon-password.fileat it, as shown inexample/configuration.nix. No agenix? Any file readable only by theminecraftuser works - just setrcon.passwordFileto its path. -
Import the module in your NixOS config:
{ inputs.minecraft-nix-server.url = "path:/etc/nixos/minecraft-nix-server"; # or a git URL once you push this somewhere }
then add
minecraft-nix-server.nixosModules.minecraftProto your host'smodules, and copy/adaptexample/configuration.nix. -
Build and switch:
nixos-rebuild switch --flake .#yourHost -
Admin from the command line:
mc-console list mc-console say "back in 5"
flake.nix entry point
modules/minecraft/ one file per concern (see ARCHITECTURE.md)
pkgs/paper.nix the server package itself
plugins/sources.nix mkPlugin helper + your plugin list
example/configuration.nix a full worked example host
docs/ARCHITECTURE.md design decisions and upgrade guides
nix flake check
nixos-rebuild build-vm --flake .#exampleHost # boots a throwaway VM