Migrate mc server to nix-minecraft flake

This commit is contained in:
William 2023-06-28 17:44:55 -03:00
parent f06979ac1d
commit 92f1c6f3fa
6 changed files with 114 additions and 41 deletions

View file

@ -9,7 +9,7 @@
./hardware-configuration.nix
./jellyfin.nix
./librespeed.nix
# ./minecraft.nix
./minecraft.nix
./nginx.nix
./paperless.nix
./searx.nix
@ -20,6 +20,5 @@
./users.nix
./variables.nix
./vaultwarden.nix
# ./whoogle.nix
];
}

View file

@ -1,19 +1,33 @@
{ inputs, config, pkgs, lib, ... }:
{
services.minecraft-server = {
let
modpack = pkgs.fetchPackwizModpack {
url =
"https://raw.githubusercontent.com/baduhai/FFS/06d253f0cd262b8d4a178d4db8e1a7188051e8d0/pack.toml";
packHash = "sha256-";
};
mcVersion = modpack.manifest.versions.minecraft;
fabricVersion = modpack.manifest.versions.fabric;
serverVersion =
lib.replaceStrings [ "." ] [ "_" ] "fabric-${mcVersion}-${fabricVersion}";
in {
services.minecraft-servers = {
enable = true;
eula = true;
declarative = true;
openFirewall = true;
package = pkgs.papermc;
serverProperties = {
motd = "Bem-vindo a Alexandria";
difficulty = "hard";
gamemode = "survival";
online-mode = "false";
spawn-protection = "0";
};
dataDir = "/data/minecraft";
servers."alexandria" = {
enable = true;
package = pkgs.fabricServers.${serverVersion};
openFirewall = true;
serverProperties = {
difficulty = "hard";
gamemode = "survival";
motd = "O Seridor";
online-mode = false;
spawn-protection = false;
};
symlink."mods" = "${modpack}/mods";
};
};
}

View file

@ -1,22 +0,0 @@
{ inputs, config, pkgs, lib, ... }:
{
virtualisation.oci-containers.containers."whoogle" = {
image = "benbusby/whoogle-search:latest";
environment = {
HTTPS_ONLY = "1";
WHOOGLE_CONFIG_LANGUAGE = "lang_en";
WHOOGLE_CONFIG_THEME = "system";
WHOOGLE_CONFIG_VIEW_IMAGE = "1";
};
ports = [ "${config.ports.whoogle}:5000" ];
extraOptions = [ "--pull=always" ];
};
services.nginx.virtualHosts."whoogle.baduhai.me" = {
useACMEHost = "baduhai.me";
forceSSL = true;
kTLS = true;
locations."/".proxyPass = "http://127.0.0.1:${config.ports.whoogle}";
};
}