2021-11-13 01:52:04 +01:00
{ lib , pkgs , . . . }:
let
papermc = {
ram = 4 ; # In GB
2022-10-12 01:29:08 +02:00
version = " 1 . 1 9 . 2 " ;
build = 200 ;
2022-10-13 21:52:40 +02:00
sha256 = " s h a 2 5 6 - f h Q 1 K u k p 0 M D F 0 3 1 2 y / D R 3 w S 9 w K X Y 2 a K U y U 5 f 6 4 E L y l M = " ;
2021-11-13 01:52:04 +01:00
} ;
2021-11-15 00:18:26 +01:00
port = 25565 ;
2021-11-13 01:52:04 +01:00
rconPort = 25575 ;
in
{
# Remote administration
environment . systemPackages = [ pkgs . mcrcon ] ;
# Use papermc
nixpkgs . overlays = [
( self : super : {
minecraft-server = super . minecraft-server . overrideAttrs ( old : {
src = pkgs . fetchurl {
url = with papermc ;
" h t t p s : / / p a p e r m c . i o / a p i / v 2 / p r o j e c t s / p a p e r / v e r s i o n s / ${ version } / b u i l d s / ${ toString build } / d o w n l o a d s / p a p e r - ${ version } - ${ toString build } . j a r " ;
sha256 = papermc . sha256 ;
} ;
} ) ;
} )
] ;
services . minecraft-server = {
enable = true ;
eula = true ;
declarative = true ;
jvmOpts = with papermc ;
" - X m s ${ toString ram } G - X m x ${ toString ram } G - X X : + U s e G 1 G C - X X : + P a r a l l e l R e f P r o c E n a b l e d - X X : M a x G C P a u s e M i l l i s = 2 0 0 - X X : + U n l o c k E x p e r i m e n t a l V M O p t i o n s - X X : + D i s a b l e E x p l i c i t G C - X X : + A l w a y s P r e T o u c h - X X : G 1 N e w S i z e P e r c e n t = 3 0 - X X : G 1 M a x N e w S i z e P e r c e n t = 4 0 - X X : G 1 H e a p R e g i o n S i z e = 8 M - X X : G 1 R e s e r v e P e r c e n t = 2 0 - X X : G 1 H e a p W a s t e P e r c e n t = 5 - X X : G 1 M i x e d G C C o u n t T a r g e t = 4 - X X : I n i t i a t i n g H e a p O c c u p a n c y P e r c e n t = 1 5 - X X : G 1 M i x e d G C L i v e T h r e s h o l d P e r c e n t = 9 0 - X X : G 1 R S e t U p d a t i n g P a u s e T i m e P e r c e n t = 5 - X X : S u r v i v o r R a t i o = 3 2 - X X : + P e r f D i s a b l e S h a r e d M e m - X X : M a x T e n u r i n g T h r e s h o l d = 1 " ;
# To get the uuids: https://mcuuid.net/
whitelist = {
gabriel_dr_dl = " 5 3 f c e d 4 9 - d a 5 1 - 4 c 8 2 - b 1 d 0 - 3 7 1 6 8 0 2 9 d b 0 8 " ;
aimie_dodo = " d 1 0 b e 0 2 0 - a 6 1 2 - 4 7 e 5 - b 0 d 0 - 9 3 8 b 9 a 7 e b 5 8 e " ;
2021-11-15 00:19:27 +01:00
RaitoMezarius = " a 4 0 0 6 8 6 e - 0 f 6 2 - 4 3 d 5 - b 5 c 6 - 4 2 9 5 b a b c c 0 0 8 " ;
2022-04-08 01:59:59 +02:00
Sup3Legacy = " 5 7 5 e c b 9 f - b f 2 8 - 4 6 c b - b c 5 0 - c b 6 b b 3 4 0 c 9 0 5 " ;
2022-04-14 01:59:59 +02:00
Pollux3737 = " f f a 6 5 8 1 8 - b 0 2 2 - 4 8 3 0 - a a 9 0 - 7 f 3 2 1 1 c 8 e e 3 d " ;
2022-05-22 01:59:59 +02:00
CiterinRemy = " 2 f 6 a 0 c 0 a - 4 c 0 e - 4 e 6 c - b e b 4 - 2 3 7 6 0 0 f b a 8 4 9 " ;
2022-10-13 21:52:40 +02:00
clem197 = " 7 4 6 1 b f d f - 4 d c a - 4 4 c 2 - b 0 3 5 - b 4 9 d 5 7 4 0 d f c 5 " ;
2022-11-05 15:48:40 +01:00
Clashis = " 4 9 9 f d d 8 5 - b b c b - 4 4 6 f - 9 6 1 1 - 8 b 6 b b 9 b f 6 9 6 5 " ;
skidijo = " 6 a 7 2 a 1 f 4 - 7 4 4 8 - 4 f b 7 - a 2 5 2 - b 6 d 5 c e f f 2 d 4 3 " ;
2022-11-14 23:46:55 +01:00
Tifendyll = " 5 d c 1 a c f 3 - b 2 1 4 - 4 6 0 7 - a 3 b d - 9 2 4 6 6 5 e 0 7 c 6 7 " ;
OknShield = " e f 1 2 e 9 c d - 1 2 1 f - 4 b 3 9 - 8 8 6 e - 8 9 b 5 b 4 b c 5 f 4 f " ;
Allygon = " 9 6 4 a 2 e e 3 - 3 a 0 d - 4 9 c 1 - b 8 e 9 - 6 0 b 5 e 6 9 9 7 6 d 3 " ;
CheesyBiggy = " 5 7 4 d a a e d - c e 9 a - 4 b 3 3 - a 3 a f - 0 5 5 e 3 9 b c 3 2 d c " ;
H3raklio = " 5 7 6 9 6 9 d 4 - 9 4 e 7 - 4 9 d b - b a 7 e - e 9 e 5 7 f f 5 a 7 5 e " ;
2022-12-03 21:15:40 +01:00
thejohncrafter = " d 3 9 5 9 9 7 4 - 3 a 0 5 - 4 a b 2 - 8 a c b - d 8 8 1 7 c 1 4 0 d 8 4 " ;
2021-11-13 01:52:04 +01:00
} ;
serverProperties = {
server-port = port ;
difficulty = " n o r m a l " ;
gamemode = " s u r v i v a l " ;
max-players = 42 ;
motd = " T h i s i s a t e s t a n d i t w i l l b r e a k " ;
view-distance = 7 ;
# Map settings
level-seed = " 9 0 5 8 1 3 6 6 3 0 9 4 4 9 5 6 7 5 5 " ;
2021-11-14 01:28:51 +01:00
level-name = " P u b l i c _ C O F " ;
2021-11-13 01:52:04 +01:00
level-type = " d e f a u l t " ;
spawn-animals = true ;
spawn-monsters = true ;
spawn-npcs = true ;
generate-structures = true ;
2022-05-12 01:59:59 +02:00
enable-command-block = true ;
2021-11-13 01:52:04 +01:00
# Whitelist
white-list = true ;
enforce-whitelist = true ;
# Admin
enable-rcon = true ;
" r c o n . p a s s w o r d " =
'' y Q Z > O . % ] f B { ' E . X = H I 1 / E n ~ i - '' ; # TODO Warning: it is written in clear in /var/lib/... with read permissions and mcrcom will transmit it without encryption
" r c o n . p o r t " = rconPort ;
admin-slot = true ;
snoop-enabled = false ;
public = false ;
# enable-jmx-monitoring = true; # https://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html
} ;
} ;
networking . firewall . allowedTCPPorts = [ port ] ;
networking . firewall . allowedUDPPorts = [ port ] ;
}