diff --git a/flake.lock b/flake.lock index cbe2fa5..a308879 100644 --- a/flake.lock +++ b/flake.lock @@ -40,6 +40,22 @@ "url": "https://git.ifsr.de/ese/manual-website" } }, + "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" @@ -94,6 +110,24 @@ "type": "github" } }, + "flake-utils_4": { + "inputs": { + "systems": "systems_5" + }, + "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" + } + }, "kpp": { "inputs": { "nixpkgs": [ @@ -143,11 +177,11 @@ ] }, "locked": { - "lastModified": 1723950649, - "narHash": "sha256-dHMkGjwwCGj0c2MKyCjRXVBXq2Sz3TWbbM23AS7/5Hc=", + "lastModified": 1724576102, + "narHash": "sha256-uM7n5nNL6fmA0bwMJBNll11f4cMWOFa2Ni6F5KeIldM=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "392828aafbed62a6ea6ccab13728df2e67481805", + "rev": "e333d62b70b179da1dd78d94315e8a390f2d12e5", "type": "github" }, "original": { @@ -156,6 +190,28 @@ "type": "github" } }, + "nix-minecraft": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1724636274, + "narHash": "sha256-Q04D7AQRjNCUJIEo5YJeRdps0HcCgvEOvk5pAUHZlF0=", + "owner": "Infinidoge", + "repo": "nix-minecraft", + "rev": "0baaf5d5781b171bb2e936b3013f963a233bc477", + "type": "github" + }, + "original": { + "owner": "Infinidoge", + "repo": "nix-minecraft", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1701253981, @@ -188,22 +244,6 @@ "type": "github" } }, - "nixpkgs-unstable": { - "locked": { - "lastModified": 1724224976, - "narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "c374d94f1536013ca8e92341b540eba4c22f9c62", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_2": { "locked": { "lastModified": 1724316499, @@ -285,8 +325,8 @@ "ese-manual": "ese-manual", "kpp": "kpp", "nix-index-database": "nix-index-database", + "nix-minecraft": "nix-minecraft", "nixpkgs": "nixpkgs_2", - "nixpkgs-unstable": "nixpkgs-unstable", "print-interface": "print-interface", "sops-nix": "sops-nix", "vscode-server": "vscode-server" @@ -372,6 +412,21 @@ "type": "github" } }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ @@ -396,7 +451,7 @@ }, "vscode-server": { "inputs": { - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_4", "nixpkgs": "nixpkgs_3" }, "locked": { diff --git a/flake.nix b/flake.nix index a150aa3..ee8418f 100755 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,6 @@ { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; - nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; sops-nix.url = "github:Mic92/sops-nix"; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; nix-index-database.url = "github:nix-community/nix-index-database"; @@ -20,11 +19,12 @@ url = "github:fsr/course-management"; # inputs.nixpkgs.follows = "nixpkgs"; }; + nix-minecraft.url = "github:Infinidoge/nix-minecraft"; + nix-minecraft.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { self , nixpkgs - , nixpkgs-unstable , sops-nix , nix-index-database , kpp @@ -32,6 +32,7 @@ , vscode-server , course-management , print-interface + , nix-minecraft , ... }@inputs: let @@ -70,6 +71,7 @@ ese-manual.nixosModules.default course-management.nixosModules.default vscode-server.nixosModules.default + nix-minecraft.nixosModules.minecraft-servers ./hosts/quitte/configuration.nix ./options @@ -95,7 +97,10 @@ ./modules/decisions.nix # ./modules/struktur-bot.nix { - nixpkgs.overlays = [ self.overlays.default ]; + nixpkgs.overlays = [ + self.overlays.default + nix-minecraft.overlay + ]; sops.defaultSopsFile = ./secrets/quitte.yaml; } ]; diff --git a/modules/minecraft/default.nix b/modules/minecraft/default.nix index 2a3a1aa..2c9ec28 100644 --- a/modules/minecraft/default.nix +++ b/modules/minecraft/default.nix @@ -1,17 +1,23 @@ -{ config, lib, nixpkgs-unstable, ... }: +{ pkgs, config, lib, ... }: { - services.minecraft-server = { + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "minecraft-server" + ]; + services.minecraft-servers = { enable = true; - # hack to enable unstable unfree package - package = nixpkgs-unstable.legacyPackages.x86_64-linux.minecraft-server.overrideAttrs (_old: { meta.license = [ lib.licenses.mit ]; }); eula = true; + servers.ifsr = { + enable = true; + package = pkgs.fabricServers.fabric-1_21; + jvmOpts = "-Xmx8192M -Xms8192M"; + }; }; services.bluemap = { enable = true; host = "map.mc.ifsr.de"; eula = true; onCalendar = "hourly"; - defaultWorld = "${config.services.minecraft-server.dataDir}/world"; + defaultWorld = "/srv/minecraft/ifsr/world"; }; services.nginx.virtualHosts."map.mc.ifsr.de".extraConfig = '' allow 141.30.0.0/16; @@ -36,9 +42,9 @@ { users = [ "minecraft" ]; commands = [ - { command = "/run/current-system/sw/bin/systemctl restart minecraft-server"; options = [ "NOPASSWD" ]; } - { command = "/run/current-system/sw/bin/systemctl start minecraft-server"; options = [ "NOPASSWD" ]; } - { command = "/run/current-system/sw/bin/systemctl stop minecraft-server"; options = [ "NOPASSWD" ]; } + { command = "/run/current-system/sw/bin/systemctl restart minecraft-server-ifsr"; options = [ "NOPASSWD" ]; } + { command = "/run/current-system/sw/bin/systemctl start minecraft-server-ifsr"; options = [ "NOPASSWD" ]; } + { command = "/run/current-system/sw/bin/systemctl stop minecraft-server-ifsr"; options = [ "NOPASSWD" ]; } ]; } ]; diff --git a/overlays/default.nix b/overlays/default.nix index 4d96577..1e9d2e3 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -13,17 +13,17 @@ in }; })); # (hopefully) fix systemd journal reading - prometheus-postfix-exporter = prev.prometheus-postfix-exporter.overrideAttrs (_old: { - patches = [ - ./prometheus-postfix-exporter/0001-cleanup-also-catch-milter-reject.patch - ]; - src = fetchFromGitHub { - owner = "adangel"; - repo = "postfix_exporter"; - rev = "414ac12ee63415eede46cb3084d755a6da6fba23"; - hash = "sha256-m1kVaO3N7XC1vtnxXX9kMiEFPmZuoopRUYgA7gQzP8w="; - }; - }); + # prometheus-postfix-exporter = prev.prometheus-postfix-exporter.overrideAttrs (_old: { + # patches = [ + # ./prometheus-postfix-exporter/0001-cleanup-also-catch-milter-reject.patch + # ]; + # src = fetchFromGitHub { + # owner = "adangel"; + # repo = "postfix_exporter"; + # rev = "414ac12ee63415eede46cb3084d755a6da6fba23"; + # hash = "sha256-m1kVaO3N7XC1vtnxXX9kMiEFPmZuoopRUYgA7gQzP8w="; + # }; + # }); # Mailman internal server error fix # https://gitlab.com/mailman/mailman/-/issues/1137 # https://github.com/NixOS/nixpkgs/pull/321136