Fixes to minecraft & minecraft-clj
This commit is contained in:
parent
0971f01d66
commit
882bfe1d53
@ -216,7 +216,9 @@ in {
|
|||||||
groups."${cfg.group}" = { members = [ cfg.user ]; };
|
groups."${cfg.group}" = { members = [ cfg.user ]; };
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 25555 ];
|
networking.firewall.allowedTCPPorts = [ 25555 ] ++ (lib.concatMap
|
||||||
|
(worldOpts: with worldOpts; [ port query-port rcon-port ])
|
||||||
|
(attrNames cfg.worlds));
|
||||||
|
|
||||||
systemd = {
|
systemd = {
|
||||||
tmpfiles.rules = map (worldOpts:
|
tmpfiles.rules = map (worldOpts:
|
||||||
@ -241,7 +243,7 @@ in {
|
|||||||
cp -f ${eula-file} ${stateDir}/eula.txt
|
cp -f ${eula-file} ${stateDir}/eula.txt
|
||||||
mkdir -p ${stateDir}/plugins
|
mkdir -p ${stateDir}/plugins
|
||||||
# Version not working...
|
# Version not working...
|
||||||
# cp -f ${witchcraft-plugin} ${stateDir}/plugins/witchcraft-plugin.jar
|
cp -f ${witchcraft-plugin} ${stateDir}/plugins/witchcraft-plugin.jar
|
||||||
chmod u+w ${stateDir}/server.properties
|
chmod u+w ${stateDir}/server.properties
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -4,53 +4,77 @@ with lib;
|
|||||||
let cfg = config.fudo.minecraft-server;
|
let cfg = config.fudo.minecraft-server;
|
||||||
|
|
||||||
in {
|
in {
|
||||||
options.fudo.minecraft-server = {
|
options.fudo.minecraft-server = with types; {
|
||||||
enable = mkEnableOption "Start a minecraft server.";
|
enable = mkEnableOption "Start a minecraft server.";
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = types.package;
|
type = package;
|
||||||
description = "Minecraft package to use.";
|
description = "Minecraft package to use.";
|
||||||
default = pkgs.minecraft-current;
|
default = pkgs.minecraft-current;
|
||||||
};
|
};
|
||||||
|
|
||||||
data-dir = mkOption {
|
data-dir = mkOption {
|
||||||
type = types.path;
|
type = path;
|
||||||
description = "Path at which to store minecraft data.";
|
description = "Path at which to store minecraft data.";
|
||||||
};
|
};
|
||||||
|
|
||||||
world-name = mkOption {
|
world-name = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
description = "Name of the server world (used in saves etc).";
|
description = "Name of the server world (used in saves etc).";
|
||||||
};
|
};
|
||||||
|
|
||||||
motd = mkOption {
|
motd = mkOption {
|
||||||
type = types.str;
|
type = str;
|
||||||
description = "Welcome message for newcomers.";
|
description = "Welcome message for newcomers.";
|
||||||
default = "Welcome to Minecraft! Have fun building...";
|
default = "Welcome to Minecraft! Have fun building...";
|
||||||
};
|
};
|
||||||
|
|
||||||
game-mode = mkOption {
|
game-mode = mkOption {
|
||||||
type = types.enum [ "survival" "creative" "adventure" "spectator" ];
|
type = enum [ "survival" "creative" "adventure" "spectator" ];
|
||||||
description = "Game mode of the server.";
|
description = "Game mode of the server.";
|
||||||
default = "survival";
|
default = "survival";
|
||||||
};
|
};
|
||||||
|
|
||||||
difficulty = mkOption {
|
difficulty = mkOption {
|
||||||
type = types.int;
|
type = int;
|
||||||
description = "Difficulty level, where 0 is peaceful and 3 is hard.";
|
description = "Difficulty level, where 0 is peaceful and 3 is hard.";
|
||||||
default = 2;
|
default = 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
allow-cheats = mkOption {
|
allow-cheats = mkOption {
|
||||||
type = types.bool;
|
type = bool;
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
allocated-memory = mkOption {
|
allocated-memory = mkOption {
|
||||||
type = types.int;
|
type = int;
|
||||||
description = "Memory (in GB) to allocate to the Minecraft server.";
|
description = "Memory (in GB) to allocate to the Minecraft server.";
|
||||||
default = 2;
|
default = 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
port = mkOption {
|
||||||
|
type = port;
|
||||||
|
description = "Port on which to run the Minecraft server.";
|
||||||
|
default = 25565;
|
||||||
|
};
|
||||||
|
|
||||||
|
query-port = mkOption {
|
||||||
|
type = port;
|
||||||
|
description = "Port for queries.";
|
||||||
|
default = 25566;
|
||||||
|
};
|
||||||
|
|
||||||
|
rcon-port = mkOption {
|
||||||
|
type = port;
|
||||||
|
description = "Port for remote commands.";
|
||||||
|
default = 25567;
|
||||||
|
};
|
||||||
|
|
||||||
|
world-seed = mkOption {
|
||||||
|
type = nullOr int;
|
||||||
|
description = "Seed to use while generating the world.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
@ -64,10 +88,15 @@ in {
|
|||||||
declarative = true;
|
declarative = true;
|
||||||
serverProperties = {
|
serverProperties = {
|
||||||
level-name = cfg.world-name;
|
level-name = cfg.world-name;
|
||||||
|
level-seed = cfg.world-seed;
|
||||||
motd = cfg.motd;
|
motd = cfg.motd;
|
||||||
difficulty = cfg.difficulty;
|
difficulty = cfg.difficulty;
|
||||||
gamemode = cfg.game-mode;
|
gamemode = cfg.game-mode;
|
||||||
allow-cheats = true;
|
allow-cheats = cfg.allow-cheats;
|
||||||
|
server-port = cfg.port;
|
||||||
|
"rcon.port" = cfg.rcon-port;
|
||||||
|
"query.port" = cfg.query-port;
|
||||||
|
pvp = cfg.allow-pvp;
|
||||||
};
|
};
|
||||||
jvmOpts = let
|
jvmOpts = let
|
||||||
opts = [
|
opts = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user