minecraft: switch to fabric

This commit is contained in:
Rouven Seifert 2024-08-26 13:53:44 +02:00
parent 72566b656a
commit 62b344a2c2
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09
4 changed files with 109 additions and 43 deletions

View file

@ -40,6 +40,22 @@
"url": "https://git.ifsr.de/ese/manual-website" "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": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@ -94,6 +110,24 @@
"type": "github" "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": { "kpp": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -143,11 +177,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1723950649, "lastModified": 1724576102,
"narHash": "sha256-dHMkGjwwCGj0c2MKyCjRXVBXq2Sz3TWbbM23AS7/5Hc=", "narHash": "sha256-uM7n5nNL6fmA0bwMJBNll11f4cMWOFa2Ni6F5KeIldM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nix-index-database", "repo": "nix-index-database",
"rev": "392828aafbed62a6ea6ccab13728df2e67481805", "rev": "e333d62b70b179da1dd78d94315e8a390f2d12e5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -156,6 +190,28 @@
"type": "github" "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1701253981, "lastModified": 1701253981,
@ -188,22 +244,6 @@
"type": "github" "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": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1724316499, "lastModified": 1724316499,
@ -285,8 +325,8 @@
"ese-manual": "ese-manual", "ese-manual": "ese-manual",
"kpp": "kpp", "kpp": "kpp",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nix-minecraft": "nix-minecraft",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2",
"nixpkgs-unstable": "nixpkgs-unstable",
"print-interface": "print-interface", "print-interface": "print-interface",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"vscode-server": "vscode-server" "vscode-server": "vscode-server"
@ -372,6 +412,21 @@
"type": "github" "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": { "treefmt-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -396,7 +451,7 @@
}, },
"vscode-server": { "vscode-server": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_4",
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {

View file

@ -1,7 +1,6 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; 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.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs"; sops-nix.inputs.nixpkgs.follows = "nixpkgs";
nix-index-database.url = "github:nix-community/nix-index-database"; nix-index-database.url = "github:nix-community/nix-index-database";
@ -20,11 +19,12 @@
url = "github:fsr/course-management"; url = "github:fsr/course-management";
# inputs.nixpkgs.follows = "nixpkgs"; # inputs.nixpkgs.follows = "nixpkgs";
}; };
nix-minecraft.url = "github:Infinidoge/nix-minecraft";
nix-minecraft.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = outputs =
{ self { self
, nixpkgs , nixpkgs
, nixpkgs-unstable
, sops-nix , sops-nix
, nix-index-database , nix-index-database
, kpp , kpp
@ -32,6 +32,7 @@
, vscode-server , vscode-server
, course-management , course-management
, print-interface , print-interface
, nix-minecraft
, ... , ...
}@inputs: }@inputs:
let let
@ -70,6 +71,7 @@
ese-manual.nixosModules.default ese-manual.nixosModules.default
course-management.nixosModules.default course-management.nixosModules.default
vscode-server.nixosModules.default vscode-server.nixosModules.default
nix-minecraft.nixosModules.minecraft-servers
./hosts/quitte/configuration.nix ./hosts/quitte/configuration.nix
./options ./options
@ -95,7 +97,10 @@
./modules/decisions.nix ./modules/decisions.nix
# ./modules/struktur-bot.nix # ./modules/struktur-bot.nix
{ {
nixpkgs.overlays = [ self.overlays.default ]; nixpkgs.overlays = [
self.overlays.default
nix-minecraft.overlay
];
sops.defaultSopsFile = ./secrets/quitte.yaml; sops.defaultSopsFile = ./secrets/quitte.yaml;
} }
]; ];

View file

@ -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; 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; eula = true;
servers.ifsr = {
enable = true;
package = pkgs.fabricServers.fabric-1_21;
jvmOpts = "-Xmx8192M -Xms8192M";
};
}; };
services.bluemap = { services.bluemap = {
enable = true; enable = true;
host = "map.mc.ifsr.de"; host = "map.mc.ifsr.de";
eula = true; eula = true;
onCalendar = "hourly"; onCalendar = "hourly";
defaultWorld = "${config.services.minecraft-server.dataDir}/world"; defaultWorld = "/srv/minecraft/ifsr/world";
}; };
services.nginx.virtualHosts."map.mc.ifsr.de".extraConfig = '' services.nginx.virtualHosts."map.mc.ifsr.de".extraConfig = ''
allow 141.30.0.0/16; allow 141.30.0.0/16;
@ -36,9 +42,9 @@
{ {
users = [ "minecraft" ]; users = [ "minecraft" ];
commands = [ commands = [
{ command = "/run/current-system/sw/bin/systemctl restart 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"; 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"; options = [ "NOPASSWD" ]; } { command = "/run/current-system/sw/bin/systemctl stop minecraft-server-ifsr"; options = [ "NOPASSWD" ]; }
]; ];
} }
]; ];

View file

@ -13,17 +13,17 @@ in
}; };
})); }));
# (hopefully) fix systemd journal reading # (hopefully) fix systemd journal reading
prometheus-postfix-exporter = prev.prometheus-postfix-exporter.overrideAttrs (_old: { # prometheus-postfix-exporter = prev.prometheus-postfix-exporter.overrideAttrs (_old: {
patches = [ # patches = [
./prometheus-postfix-exporter/0001-cleanup-also-catch-milter-reject.patch # ./prometheus-postfix-exporter/0001-cleanup-also-catch-milter-reject.patch
]; # ];
src = fetchFromGitHub { # src = fetchFromGitHub {
owner = "adangel"; # owner = "adangel";
repo = "postfix_exporter"; # repo = "postfix_exporter";
rev = "414ac12ee63415eede46cb3084d755a6da6fba23"; # rev = "414ac12ee63415eede46cb3084d755a6da6fba23";
hash = "sha256-m1kVaO3N7XC1vtnxXX9kMiEFPmZuoopRUYgA7gQzP8w="; # hash = "sha256-m1kVaO3N7XC1vtnxXX9kMiEFPmZuoopRUYgA7gQzP8w=";
}; # };
}); # });
# Mailman internal server error fix # Mailman internal server error fix
# https://gitlab.com/mailman/mailman/-/issues/1137 # https://gitlab.com/mailman/mailman/-/issues/1137
# https://github.com/NixOS/nixpkgs/pull/321136 # https://github.com/NixOS/nixpkgs/pull/321136