flake/modules/nixos/server/gaming/astral.nix
2024-07-21 11:30:47 +00:00

48 lines
1.5 KiB
Nix

{ pkgs, lib, config, inputs, ... }:
let
modpack = pkgs.fetchPackwizModpack {
# version = "main";
url = "https://github.com/nix-astral/create-astral/raw/main/pack.toml";
packHash = "sha256-QcUg4PRxgGdQIB5d+XnJCmhh6+r/zDtWRFSTkSOR1ik=";
manifestHash = "sha256:16pjv73nv7a5fy6rvzgg88228niirnwd0ip7mw5dmzd7q1b0xqsr";
};
mcVersion = modpack.manifest.versions.minecraft;
fabricVersion = modpack.manifest.versions.fabric;
serverVersion = lib.replaceStrings [ "." ] [ "_" ] "fabric-${mcVersion}";
in {
options.mods.server.astral = {
enable = lib.mkEnableOption {
default = false;
description = "enables minecraft create astral server";
};
memory = lib.mkOption {
default = "4G";
description = "server detitated wam";
};
autoStart = lib.mkEnableOption {
default = true;
description = "start server on boot";
};
};
config = lib.mkIf config.mods.server.astral.enable {
services.minecraft-servers.servers.astral = {
enable = true;
serverProperties = {
online-mode = true;
};
autoStart = config.mods.server.astral.autoStart;
jvmOpts = (import ./aikar-flags.nix) config.mods.server.astral.memory;
package = pkgs.fabricServers.${serverVersion}.override {
loaderVersion = fabricVersion;
};
symlinks = {
"global_packs" = "${modpack}/global_packs";
"kubejs" = "${modpack}/kubejs";
"config" = "${modpack}/config";
"mods" = "${modpack}/mods";
};
};
};
}