diff --git a/flake.lock b/flake.lock index 63399e1..3f3adfe 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,39 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -60,18 +94,38 @@ "type": "github" } }, - "nixpkgs": { + "nix-minecraft": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, "locked": { - "lastModified": 1703467016, - "narHash": "sha256-/5A/dNPhbQx/Oa2d+Get174eNI3LERQ7u6WTWOlR1eQ=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "d02d818f22c777aa4e854efc3242ec451e5d462a", + "lastModified": 1703812100, + "narHash": "sha256-JN8qbWz6OPEEPwP+AmfAmlhPE19RqUqND6hGAeK2Od0=", + "owner": "Infinidoge", + "repo": "nix-minecraft", + "rev": "7d23e6f5635499a34d09950981cf42bb072f4fa2", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixos-23.11", + "owner": "Infinidoge", + "repo": "nix-minecraft", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1698318101, + "narHash": "sha256-gUihHt3yPD7bVqg+k/UVHgngyaJ3DMEBchbymBMvK1E=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "63678e9f3d3afecfeafa0acead6239cdb447574c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -107,12 +161,29 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1703467016, + "narHash": "sha256-/5A/dNPhbQx/Oa2d+Get174eNI3LERQ7u6WTWOlR1eQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d02d818f22c777aa4e854efc3242ec451e5d462a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", "matrix-synapse-next": "matrix-synapse-next", "nix-darwin": "nix-darwin", - "nixpkgs": "nixpkgs", + "nix-minecraft": "nix-minecraft", + "nixpkgs": "nixpkgs_2", "sops-nix": "sops-nix", "unstable": "unstable", "voyager-addons": "voyager-addons" @@ -139,6 +210,21 @@ "type": "github" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "unstable": { "locked": { "lastModified": 1703438236, diff --git a/flake.nix b/flake.nix index 25639fe..cc3a277 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,7 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; matrix-synapse-next.url = "github:dali99/nixos-matrix-modules"; + nix-minecraft.url = "github:Infinidoge/nix-minecraft"; voyager-addons.url = "git+ssh://git@git.feal.no:2222/felixalb/voyager-addons.git"; @@ -23,6 +24,7 @@ self , home-manager , matrix-synapse-next + , nix-minecraft , nix-darwin , nixpkgs , sops-nix diff --git a/hosts/defiant/services/minecraft.nix b/hosts/defiant/services/minecraft.nix index 2cd1f68..db4400e 100644 --- a/hosts/defiant/services/minecraft.nix +++ b/hosts/defiant/services/minecraft.nix @@ -1,11 +1,62 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, inputs, ... }: { - services.minecraft-server = { + imports = [ inputs.nix-minecraft.nixosModules.minecraft-servers ]; + nixpkgs.overlays = [ inputs.nix-minecraft.overlay ]; + + services.minecraft-servers = { enable = true; - package = pkgs.unstable.papermc; eula = true; - jvmOpts = "-Xms2G -Xmx4G"; openFirewall = true; + dataDir = "/var/lib/minecraft-wack"; + + servers.wack = { + enable = true; + jvmOpts = "-Xms4G -Xmx4G"; + + package = pkgs.fabricServers.fabric-1_20_4; + + serverProperties = { + motd = "WackAttack M1n3cr4f7"; + white-list = true; + difficulty = "normal"; + view-distance = 16; + simulation-distance = 16; + enable-command-block = true; + enable-rcon = true; + "rcon.password" = "wack"; + }; + + symlinks = { + mods = pkgs.linkFarmFromDrvs "mods" (builtins.attrValues { + FabricAPI = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/P7dR8mSH/versions/JMCwDuki/fabric-api-0.92.0%2B1.20.4.jar"; + sha256 = "sha256-7U0BK5CBENWY4s3t+dXTASprIeY4Tdeyzc06lNGkc/Q="; + }; + Lithium = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/gvQqBUqZ/versions/nMhjKWVE/lithium-fabric-mc1.20.4-0.12.1.jar"; + sha256 = "sha256-as1JWV7mnhJkz8eYmPVpRS5BvWaYVGf8s40oBBka880="; + }; + MCDiscordChat = pkgs.fetchurl { + url = "https://cdn.modrinth.com/data/D0sHdnXY/versions/tldGNWOW/MC-Discord-Chat-2.2.5.jar"; + sha256 = "sha256-WK02gRNbTjbjQSIlWHP4aBSeGTZxtXwwbqt9fa7AJTA="; + }; + }); + }; + + whitelist = { + Taschmex = "a3a258b0-901f-43d9-b130-dad3b29cd7ee"; + Dandellion = "f393413b-59fc-49d7-a5c4-83a5d177132c"; + "_Oblivion" = "289be565-d73e-4cb1-a047-dcc319acdc80"; + Crisju = "8b77dc43-27ba-4710-bbfd-4e01e6ec7461"; + koppern = "3450494c-b945-4fa2-938c-5519adec005f"; + }; + }; }; + + # TODO: Automated backup job (https://git.pvv.ntnu.no/Drift/pvv-nixos-config/src/commit/57d1dfd121fdb23fcef54e0632f6f6278c6bb753/hosts/greddost/services/minecraft/default.nix#L144) + + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "minecraft-server" + ]; }