diff options
author | azahi <azat@bahawi.net> | 2024-11-10 01:08:38 +0300 |
---|---|---|
committer | azahi <azat@bahawi.net> | 2024-11-10 01:08:38 +0300 |
commit | 693768ee37098dbebb38c86e27044f2faa38348d (patch) | |
tree | 37c92a1c83cf22fa5e5a570baa8598ba6063c795 /modules/games/minecraft.nix | |
parent | 2024-10-29 (diff) |
Diffstat (limited to 'modules/games/minecraft.nix')
-rw-r--r-- | modules/games/minecraft.nix | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/modules/games/minecraft.nix b/modules/games/minecraft.nix index f93a139..f849360 100644 --- a/modules/games/minecraft.nix +++ b/modules/games/minecraft.nix @@ -5,7 +5,6 @@ pkgs, ... }: -with lib; let cfg = config.nixfiles.modules.games.minecraft; in @@ -13,28 +12,30 @@ in imports = [ inputs.minecraft.nixosModules.minecraft-servers ]; options.nixfiles.modules.games.minecraft = { - client.enable = mkEnableOption "Minecraft client"; + client.enable = lib.mkEnableOption "Minecraft client"; server = { - enable = mkEnableOption "Minecraft server"; + enable = lib.mkEnableOption "Minecraft server"; - port = mkOption { + port = lib.mkOption { description = "Server port."; - type = types.port; + type = lib.types.port; default = 25565; }; - memory = mkOption { + memory = lib.mkOption { description = "Amount of RAM to allocate."; - type = types.str; + type = lib.types.str; default = "2G"; }; }; }; - config = mkMerge [ - (mkIf cfg.client.enable { hm.home.packages = [ pkgs.prismlauncher ]; }) - (mkIf cfg.server.enable { - nixfiles.modules.common.nix.allowedUnfreePackages = [ "minecraft-server" ]; + config = lib.mkMerge [ + (lib.mkIf cfg.client.enable { hm.home.packages = [ pkgs.prismlauncher ]; }) + (lib.mkIf cfg.server.enable { + nixfiles.modules.common.nix.allowedUnfreePackages = [ + "minecraft-server" # proprietary + ]; ark.directories = [ config.services.minecraft-servers.dataDir ]; @@ -50,7 +51,7 @@ in # https://api.papermc.io/v2/projects/paper # https://github.com/Infinidoge/nix-minecraft/blob/master/pkgs/paper-servers/lock.json - package = pkgs.paperServers.paper-1_21_47; + package = pkgs.minecraftServers.paper-1_21_3; serverProperties = { # motd = ""; @@ -71,7 +72,7 @@ in }; jvmOpts = - (concatStringsSep " " [ + (lib.concatStringsSep " " [ "-Xms${cfg.server.memory}" "-Xmx${cfg.server.memory}" "--add-modules=jdk.incubator.vector" # Required by some plugins. |