Compare commits
3 commits
ca3d21b3ad
...
c6973a36e1
Author | SHA1 | Date | |
---|---|---|---|
|
c6973a36e1 | ||
|
e9a9a5bc26 | ||
|
f5b1acda4f |
|
@ -22,6 +22,7 @@
|
||||||
./services/foundryvtt.nix
|
./services/foundryvtt.nix
|
||||||
./services/gitea.nix
|
./services/gitea.nix
|
||||||
./services/metrics
|
./services/metrics
|
||||||
|
./services/minecraft.nix
|
||||||
./services/nextcloud.nix
|
./services/nextcloud.nix
|
||||||
./services/webserver.nix
|
./services/webserver.nix
|
||||||
./services/wireguard.nix
|
./services/wireguard.nix
|
||||||
|
@ -70,8 +71,6 @@
|
||||||
8448
|
8448
|
||||||
# starbound
|
# starbound
|
||||||
21025
|
21025
|
||||||
# Minecraft
|
|
||||||
25565
|
|
||||||
|
|
||||||
config.services.coturn.listening-port
|
config.services.coturn.listening-port
|
||||||
config.services.coturn.tls-listening-port
|
config.services.coturn.tls-listening-port
|
||||||
|
@ -80,9 +79,6 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
allowedUDPPorts = [
|
allowedUDPPorts = [
|
||||||
# More minecraft
|
|
||||||
25565
|
|
||||||
|
|
||||||
config.services.coturn.listening-port
|
config.services.coturn.listening-port
|
||||||
config.services.coturn.tls-listening-port
|
config.services.coturn.tls-listening-port
|
||||||
config.services.coturn.alt-listening-port
|
config.services.coturn.alt-listening-port
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
parserWhitelist = [
|
parserWhitelist = [
|
||||||
"1.64.239.213"
|
"10.45.249.2"
|
||||||
];
|
];
|
||||||
|
|
||||||
extraGroups = [
|
extraGroups = [
|
||||||
|
|
83
configuration/services/minecraft.nix
Normal file
83
configuration/services/minecraft.nix
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
services.minecraft-server = {
|
||||||
|
enable = true;
|
||||||
|
eula = true;
|
||||||
|
# jvmOpts are set using a file for forge
|
||||||
|
# jvmOpts = "-Xmx8G -Xms8G";
|
||||||
|
openFirewall = true;
|
||||||
|
|
||||||
|
declarative = true;
|
||||||
|
|
||||||
|
whitelist = {
|
||||||
|
tlater = "140d177a-966f-41b8-a4c0-e305babd291b";
|
||||||
|
romino25 = "59cd1648-14a4-4bcf-8f5a-2e1bde678f2c";
|
||||||
|
lasi25 = "0ab6e3d1-544a-47e7-8538-2e6c248e49a4";
|
||||||
|
};
|
||||||
|
|
||||||
|
serverProperties = {
|
||||||
|
allow-flight = true;
|
||||||
|
difficulty = "hard";
|
||||||
|
motd = "tlater.net";
|
||||||
|
spawn-protection = 1;
|
||||||
|
white-list = true;
|
||||||
|
enable-query = true;
|
||||||
|
enable-status = true;
|
||||||
|
|
||||||
|
# Allows the server to write chunks without hogging the main
|
||||||
|
# thread...
|
||||||
|
sync-chunk-writes = false;
|
||||||
|
# Disables chat reporting, because we don't need any of that
|
||||||
|
# drama on a lil' friends-only server.
|
||||||
|
enforce-secure-profile = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
package = pkgs.writeShellApplication {
|
||||||
|
name = "minecraft-server";
|
||||||
|
runtimeInputs = with pkgs; [ jdk17_headless ];
|
||||||
|
|
||||||
|
text = ''
|
||||||
|
exec /var/lib/minecraft/run.sh $@
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.minecraft-server = {
|
||||||
|
path = with pkgs; [ jdk17_headless ];
|
||||||
|
|
||||||
|
# Since we read from our own HTTP server, we need to wait for it
|
||||||
|
# to be up
|
||||||
|
after = [ "nginx.service" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
# Use packwiz to install mods
|
||||||
|
ExecStartPre = [
|
||||||
|
"${pkgs.jdk17_headless}/bin/java -jar ${config.services.minecraft-server.dataDir}/packwiz-installer-bootstrap.jar -g -s server 'https://minecraft.${config.services.nginx.domain}/cobblemon-pack/pack.toml'"
|
||||||
|
];
|
||||||
|
# Forge requires some bonus JVM options, which they include in a
|
||||||
|
# little `run.sh` script
|
||||||
|
ExecStart = lib.mkForce "${config.services.minecraft-server.dataDir}/run.sh --nogui";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.tmpfiles.settings."10-minecraft" = {
|
||||||
|
"/srv/minecraft".d = {
|
||||||
|
user = "nginx";
|
||||||
|
group = "minecraft";
|
||||||
|
mode = "0775";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.nginx.virtualHosts."minecraft.${config.services.nginx.domain}" = {
|
||||||
|
forceSSL = true;
|
||||||
|
useACMEHost = "tlater.net";
|
||||||
|
enableHSTS = true;
|
||||||
|
|
||||||
|
root = "/srv/minecraft";
|
||||||
|
};
|
||||||
|
}
|
19
flake.lock
19
flake.lock
|
@ -266,11 +266,11 @@
|
||||||
"treefmt-nix": "treefmt-nix"
|
"treefmt-nix": "treefmt-nix"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1731205797,
|
"lastModified": 1738741221,
|
||||||
"narHash": "sha256-F7N1mxH1VrkVNHR3JGNMRvp9+98KYO4b832KS8Gl2xI=",
|
"narHash": "sha256-UiTOA89yQV5YNlO1ZAp4IqJUGWOnTyBC83netvt8rQE=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "poetry2nix",
|
"repo": "poetry2nix",
|
||||||
"rev": "f554d27c1544d9c56e5f1f8e2b8aff399803674e",
|
"rev": "be1fe795035d3d36359ca9135b26dcc5321b31fb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -381,11 +381,11 @@
|
||||||
"poetry2nixi": "poetry2nixi"
|
"poetry2nixi": "poetry2nixi"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1733296058,
|
"lastModified": 1738867540,
|
||||||
"narHash": "sha256-2tYgb4TbvoLk+zsRdCPaglP0s9GCG5HOR9Jm9rsSiHU=",
|
"narHash": "sha256-co2Fs1VoWtTzo7IAeRtaNnyofoUWFOv/Aa/+vSorurA=",
|
||||||
"ref": "refs/heads/main",
|
"ref": "refs/heads/main",
|
||||||
"rev": "5f01c17df4dbe841bb6ccd85993c0d9b7368af72",
|
"rev": "c6eeff42799c9d4073a241056198004d89bf87df",
|
||||||
"revCount": 13,
|
"revCount": 15,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "ssh://git@github.com/sonnenshift/battery-manager"
|
"url": "ssh://git@github.com/sonnenshift/battery-manager"
|
||||||
},
|
},
|
||||||
|
@ -454,8 +454,9 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "systems",
|
"owner": "nix-systems",
|
||||||
"type": "indirect"
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tlaternet-webserver": {
|
"tlaternet-webserver": {
|
||||||
|
|
Loading…
Reference in a new issue