diff --git a/flake.lock b/flake.lock index 604b7af..6eba3b4 100644 --- a/flake.lock +++ b/flake.lock @@ -34,6 +34,22 @@ } }, "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-compat_2": { "flake": false, "locked": { "lastModified": 1696426674, @@ -49,6 +65,24 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": "systems_2" + }, + "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": [ @@ -231,6 +265,26 @@ "type": "github" } }, + "nix-minecraft": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1723685111, + "narHash": "sha256-vQiq7jAdF1ePFJjk67jYCpJagi1zzKGiyR3hHPrabzE=", + "owner": "Infinidoge", + "repo": "nix-minecraft", + "rev": "e13ed71bc4b9625e4b2779f328cb103b86c84da4", + "type": "github" + }, + "original": { + "owner": "Infinidoge", + "repo": "nix-minecraft", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1723175592, @@ -248,6 +302,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1715266358, + "narHash": "sha256-doPgfj+7FFe9rfzWo1siAV2mVCasW+Bh8I1cToAXEE4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "f1010e0469db743d14519a1efd37e23f8513d714", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1723362943, "narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=", @@ -267,13 +337,14 @@ "inputs": { "home-manager": "home-manager", "hyprland": "hyprland", - "nixpkgs": "nixpkgs_2", + "nix-minecraft": "nix-minecraft", + "nixpkgs": "nixpkgs_3", "spicetify-nix": "spicetify-nix" } }, "spicetify-nix": { "inputs": { - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "nixpkgs": [ "nixpkgs" ] @@ -307,6 +378,21 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "xdph": { "inputs": { "hyprland-protocols": "hyprland-protocols", diff --git a/flake.nix b/flake.nix index fec26b5..cd5b946 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,8 @@ }; hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; + + nix-minecraft.url = "github:Infinidoge/nix-minecraft"; }; outputs = diff --git a/nixos.nix b/nixos.nix index 703e288..564c474 100644 --- a/nixos.nix +++ b/nixos.nix @@ -24,6 +24,7 @@ in ./services/archi.nix ./services/caddy.nix ./services/jellyfin.nix + ./services/minecraft ]; # Enable experimental features diff --git a/services/minecraft/default.nix b/services/minecraft/default.nix new file mode 100644 index 0000000..3494d42 --- /dev/null +++ b/services/minecraft/default.nix @@ -0,0 +1,49 @@ +{ pkgs, nix-minecraft, ... }: + +let + modpack = pkgs.fetchPackwizModpack { + url = "http://files.thewizard.link/horror/pack.toml"; + packHash = "sha256-Huqdl1nGMJC/hvkK8HKxOMHectFioY7zaNeT+D6Ur/8="; + }; +in +{ + imports = [ nix-minecraft.nixosModules.minecraft-servers ]; + nixpkgs.overlays = [ nix-minecraft.overlay ]; + + # Needed to package modpacks. + environment.systemPackages = [ pkgs.packwiz ]; + + services.minecraft-servers = { + enable = true; + eula = true; + openFirewall = true; + + servers = { + horror = { + enable = true; + package = pkgs.fabricServers.fabric-1_20_6; + autoStart = true; + + jvmOpts = "-Xms512M -Xmx8192M"; + + serverProperties = { + allow-flight = true; + difficulty = "normal"; + enforce-secure-profile = true; + level-name = "horror"; + motd = "\\u00A70Are you a hero?\\u00A7r"; + pvp = true; + resource-pack = "https://cdn.modrinth.com/data/p1WH6sHr/versions/3lQn31SZ/From-The-Fog-1.20.5-1.20.6-v1.9.3-Data-Resource-Pack.zip"; + server-ip = "192.168.0.100"; + server-port = 25565; + view-distance = 16; + }; + + symlinks = { + mods = "${modpack}/mods"; + "ops.json" = ./ops.json; + }; + }; + }; + }; +} diff --git a/services/minecraft/ops.json b/services/minecraft/ops.json new file mode 100644 index 0000000..0492ee5 --- /dev/null +++ b/services/minecraft/ops.json @@ -0,0 +1,7 @@ +[ + { + "uuid": "55a58451-8fe9-4dfe-8011-1509e948e7a6", + "name": "WizardlinK", + "level": 4 + } +]