Migrate to nix-minecraft

This commit is contained in:
♥ Minnie ♥ 2024-06-03 20:53:43 +08:00
parent 354d4ffbe5
commit 65764d76ff
Signed by: jasmine
GPG key ID: 8563E358D4E8040E
6 changed files with 90 additions and 22 deletions

View file

@ -12,13 +12,16 @@
inputs.nixpkgs.follows = "nixpkgs";
};
# Add any other flake you might need
# Flakes our configuration is dependent on.
agenix.url = "github:ryantm/agenix";
agenix-rekey = {
url = "github:oddlama/agenix-rekey";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence.url = "github:nix-community/impermanence";
# Add any other flake you might need.
nix-minecraft.url = "github:Infinidoge/nix-minecraft";
};
outputs = { self, nixpkgs, home-manager, ... }@inputs:

View file

@ -6,14 +6,12 @@
./homarr.nix
./jellyfin.nix
./jellyseerr.nix
./minecraft.nix
./lidarr.nix
./prowlarr.nix
./qbittorrent.nix
./radarr.nix
./recyclarr.nix
./sonarr.nix
./microbin
];
virtualisation.oci-containers.backend = "docker";

View file

@ -1,19 +0,0 @@
{ ... }:
{
virtualisation.oci-containers.containers = {
minecraft = {
autoStart = true;
image = "itzg/minecraft-server";
ports = [
"25565:25565"
];
volumes = [
"/srv/containers/minecraft:/data:rw"
];
environment = {
EULA = "true";
};
};
};
}

View file

@ -3,6 +3,7 @@
{
imports = [
./traefik
./minecraft
./borgbackup.nix
./mpd.nix
];

View file

@ -0,0 +1,77 @@
{ inputs, pkgs, lib, ... }:
let
modpack = pkgs.fetchPackwizModpack rec {
version = "c9087bf";
url = "https://github.com/sajenim/minecraft-modpack/raw/${version}/pack.toml";
packHash = "sha256-F3moe9sxYSbJtPhkCRilqR91Ox+YlBrHN/dXykNajDs=";
};
mcVersion = modpack.manifest.versions.minecraft;
fabricVersion = modpack.manifest.versions.fabric;
serverVersion = lib.replaceStrings [ "." ] [ "_" ] "fabric-${mcVersion}";
in
{
imports = [
inputs.nix-minecraft.nixosModules.minecraft-servers
];
nixpkgs.overlays = [
inputs.nix-minecraft.overlay
];
services.minecraft-servers = {
# Enable all of our servers
enable = true;
# Our minecraft servers
servers = {
kanto = {
enable = true;
# The minecraft server package to use.
package = pkgs.fabricServers.${serverVersion}.override { loaderVersion = fabricVersion; }; # Specific fabric loader version.
# Allowed players
whitelist = {
jasmariiie = "82fc15bb-6839-4430-b5e9-39c5294ff32f";
Spectre_HWS = "491c085e-f0dc-44f1-9fdc-07c7cfcec8f2";
};
# JVM options for the minecraft server.
jvmOpts = "-Xmx8G";
# Minecraft server properties for the server.properties file.
serverProperties = {
gamemode = "survival";
difficulty = "normal";
motd = "\\u00A7aKanto Network \\u00A7e[1.19.2]\\u00A7r\\n\\u00A78I'll Use My Trusty Frying Pan As A Drying Pan!";
server-port = 25565;
white-list = true;
};
# Things to symlink into this server's data directory.
symlinks = {
"mods" = "${modpack}/mods";
};
# Things to copy into this server's data directory.
files = {
"ops.json" = ./ops.json;
# Youre in grave danger
"config/yigd.toml" = "${modpack}/config/yigd.toml";
};
# Value of systemd's `Restart=` service configuration option.
restart = "no";
};
};
# Each server will be under a subdirectory named after the server name.
dataDir = "/srv/services/minecraft";
# Open firewall for all servers.
openFirewall = true;
# https://account.mojang.com/documents/minecraft_eula
eula = true;
};
}

View file

@ -0,0 +1,8 @@
[
{
"uuid": "82fc15bb-6839-4430-b5e9-39c5294ff32f",
"name": "jasmariiie",
"level": 4
}
]