add mc server

This commit is contained in:
DACHXY 2025-03-27 21:14:38 +08:00
parent 43e206bd6d
commit 973313256a
6 changed files with 177 additions and 4 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
**/result

92
flake.lock generated
View file

@ -224,6 +224,22 @@
"type": "github"
}
},
"flake-compat_7": {
"flake": false,
"locked": {
"lastModified": 1733328505,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
@ -341,6 +357,24 @@
"type": "github"
}
},
"flake-utils_4": {
"inputs": {
"systems": "systems_7"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"ghostty": {
"inputs": {
"flake-compat": "flake-compat_2",
@ -953,6 +987,26 @@
"type": "github"
}
},
"nix-minecraft": {
"inputs": {
"flake-compat": "flake-compat_7",
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1742608263,
"narHash": "sha256-NMd7fpj04y0srAbHa19o7xMk19MzIrwkOKz57mxJC5E=",
"owner": "Infinidoge",
"repo": "nix-minecraft",
"rev": "341dc497af2d985ec97a9b5c935674b885706e52",
"type": "github"
},
"original": {
"owner": "Infinidoge",
"repo": "nix-minecraft",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1739020877,
@ -1081,6 +1135,22 @@
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1739866667,
"narHash": "sha256-EO1ygNKZlsAC9avfcwHkKGMsmipUk1Uc0TbrEZpkn64=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "73cf49b8ad837ade2de76f87eb53fc85ed5d4680",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1737003892,
"narHash": "sha256-RCzJE9wKByLCXmRBp+z8LK9EgdW+K+W/DXnJS4S/NVo=",
@ -1160,7 +1230,8 @@
"lanzaboote": "lanzaboote",
"neovim-nightly-overlay": "neovim-nightly-overlay",
"nix-index-database": "nix-index-database",
"nixpkgs": "nixpkgs_3",
"nix-minecraft": "nix-minecraft",
"nixpkgs": "nixpkgs_4",
"nixpkgs-unstable": "nixpkgs-unstable_2",
"yazi": "yazi"
}
@ -1297,6 +1368,21 @@
"type": "github"
}
},
"systems_7": {
"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": [
@ -1361,8 +1447,8 @@
},
"yazi": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_4",
"flake-utils": "flake-utils_4",
"nixpkgs": "nixpkgs_5",
"rust-overlay": "rust-overlay_2"
},
"locked": {

View file

@ -64,6 +64,10 @@
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-minecraft = {
url = "github:Infinidoge/nix-minecraft";
};
};
nixConfig = {
@ -135,6 +139,7 @@
modules = [
disko.nixosModules.disko
nix-index-database.nixosModules.nix-index
inputs.nix-minecraft.nixosModules.minecraft-servers
lanzaboote.nixosModules.lanzaboote
./system/dev/dn-server
];

View file

@ -1,5 +1,6 @@
{
lib,
pkgs,
unstable,
inputs,
system,
@ -52,6 +53,27 @@ in
system.stateVersion = nix-version;
services.wallpaperEngine.enable = lib.mkForce false;
environment.systemPackages = [
pkgs.lunar-client
(pkgs.ferium.overrideAttrs (
final: prev: rec {
cargoHash = "sha256-yedl4KQCpT7Ai1EPvwD5kzhkHesIjGVAcxKjp5k2jmI=";
version = "4.7.0";
src = pkgs.fetchFromGitHub {
owner = "gorilla-devs";
repo = prev.pname;
rev = "v${version}";
hash = "sha256-jj3BdaxH7ofhHNF2eu+burn6+/0bPQQZ8JfjXAFyN4A=";
};
cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
inherit (final) pname src version;
hash = final.cargoHash;
};
}
))
];
home-manager = {
backupFileExtension = "backup";
useUserPackages = true;

View file

@ -1,6 +1,7 @@
{
lib,
unstable,
pkgs,
inputs,
system,
nix-version,
@ -39,6 +40,29 @@ in
# ../../modules/wine.nix
];
nixpkgs.overlays = [ inputs.nix-minecraft.overlay ];
environment.systemPackages = [
(pkgs.ferium.overrideAttrs (
final: prev: rec {
cargoHash = "sha256-yedl4KQCpT7Ai1EPvwD5kzhkHesIjGVAcxKjp5k2jmI=";
version = "4.7.0";
src = pkgs.fetchFromGitHub {
owner = "gorilla-devs";
repo = prev.pname;
rev = "v${version}";
hash = "sha256-jj3BdaxH7ofhHNF2eu+burn6+/0bPQQZ8JfjXAFyN4A=";
};
cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
inherit (final) pname src version;
useFetchCargoVendor = true;
hash = final.cargoHash;
};
}
))
];
# Overrides
networking.hostName = lib.mkForce device-name;

View file

@ -117,8 +117,12 @@ in
53
personal.port
kube.port
25565
];
allowedTCPPorts = sshPorts ++ [
53
25565
];
allowedTCPPorts = sshPorts ++ [ 53 ];
};
nftables = {
@ -269,6 +273,37 @@ in
gvfs.enable = true;
udisks2.enable = true;
devmon.enable = true;
minecraft-servers = {
enable = true;
eula = true;
openFirewall = true;
servers = {
prominence = {
enable = true;
package = pkgs.fabricServers.fabric-1_20_1.override {
loaderVersion = "0.16.10";
};
jvmOpts = "-Xmx24G -Xms4G";
symlinks = {
"config" = "/etc/minecraft/prominence/config";
"defaultconfigs" = "/etc/minecraft/prominence/defaultconfigs";
"modernfix" = "/etc/minecraft/prominence/modernfix";
"schematics" = "/etc/minecraft/prominence/schematics";
"manifest.json" = "/etc/minecraft/prominence/manifest.json";
"server-icon.png" = "/etc/minecraft/prominence/server-icon.png";
"mods" = "/etc/minecraft/prominence/mods";
};
serverProperties = {
server-port = 25565;
motd = "";
};
};
};
};
};
users.users = {