40 lines
1.0 KiB
Nix
40 lines
1.0 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}: let
|
|
cfg = config.hive.minecraft-server;
|
|
|
|
modpack = pkgs.callPackage ./loadCurseForge.nix {
|
|
url = "https://mediafilez.forgecdn.net/files/7765/203/BMC3_Server_Pack_v44.zip";
|
|
hash = "";
|
|
};
|
|
|
|
mcVersion = modpack.variables.MINECRAFT_VERSION;
|
|
loader = lib.toLower modpack.variables.MODLOADER;
|
|
loaderVersion = modpack.variables.MODLOADER_VERSION;
|
|
serverVersion = lib.replaceStrings ["."] ["_"] "${loader}-${mcVersion}";
|
|
in {
|
|
options.hive.minecraft-server = {
|
|
enable = lib.mkEnableOption "Enable BMC3 server";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
services.minecraft-servers.servers.bmc3 =
|
|
{
|
|
enable = true;
|
|
eula = true;
|
|
}
|
|
# Prevent download of modpack if not enabled
|
|
// (lib.optionalAttrs cfg.enable {
|
|
package = pkgs."${loader}Servers".${serverVersion}.override {inherit loaderVersion;};
|
|
jvmOpts = modpack.variables.JAVA_ARGS;
|
|
symlinks = {
|
|
"mods" = modpack.mods;
|
|
"config" = modpack.config;
|
|
};
|
|
});
|
|
};
|
|
}
|