about summary refs log tree commit diff
path: root/modules/games/minecraft.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/games/minecraft.nix')
-rw-r--r--modules/games/minecraft.nix27
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.

Consider giving Nix/NixOS a try! <3