Migrate mc server to nix-minecraft flake
This commit is contained in:
parent
f06979ac1d
commit
92f1c6f3fa
6 changed files with 114 additions and 41 deletions
76
flake.lock
generated
76
flake.lock
generated
|
|
@ -132,10 +132,44 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-compat_3": {
|
||||||
|
"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"
|
||||||
},
|
},
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils_2": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems_2"
|
||||||
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1685518550,
|
"lastModified": 1685518550,
|
||||||
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
||||||
|
|
@ -251,6 +285,28 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nix-minecraft": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat_2",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1687917420,
|
||||||
|
"narHash": "sha256-56L07MZrKOxBz18H+UI4ltDAbEYCc15bvkPZ7+AXkcQ=",
|
||||||
|
"owner": "Infinidoge",
|
||||||
|
"repo": "nix-minecraft",
|
||||||
|
"rev": "2021eee2668afd94517eec3e1d2cfcc8aaca8fdf",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Infinidoge",
|
||||||
|
"repo": "nix-minecraft",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixlib": {
|
"nixlib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1685840432,
|
"lastModified": 1685840432,
|
||||||
|
|
@ -353,8 +409,8 @@
|
||||||
},
|
},
|
||||||
"pre-commit-hooks": {
|
"pre-commit-hooks": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat_2",
|
"flake-compat": "flake-compat_3",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils_2",
|
||||||
"gitignore": "gitignore",
|
"gitignore": "gitignore",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
|
|
@ -384,6 +440,7 @@
|
||||||
"home-manager": "home-manager_2",
|
"home-manager": "home-manager_2",
|
||||||
"homepage": "homepage",
|
"homepage": "homepage",
|
||||||
"kmonad": "kmonad",
|
"kmonad": "kmonad",
|
||||||
|
"nix-minecraft": "nix-minecraft",
|
||||||
"nixos-generators": "nixos-generators",
|
"nixos-generators": "nixos-generators",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"nixpkgs-stable": "nixpkgs-stable",
|
"nixpkgs-stable": "nixpkgs-stable",
|
||||||
|
|
@ -405,6 +462,21 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"systems_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"utils": {
|
"utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1667395993,
|
"lastModified": 1667395993,
|
||||||
|
|
|
||||||
14
flake.nix
14
flake.nix
|
|
@ -46,11 +46,16 @@
|
||||||
url = "github:cachix/pre-commit-hooks.nix";
|
url = "github:cachix/pre-commit-hooks.nix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nix-minecraft = {
|
||||||
|
url = "github:Infinidoge/nix-minecraft";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs@{ self, nixpkgs, home-manager, baduhai-nur, kmonad
|
outputs = inputs@{ self, nixpkgs, home-manager, baduhai-nur, kmonad
|
||||||
, nixpkgs-stable, deploy-rs, agenix, nixos-generators, homepage, dotfiles
|
, nixpkgs-stable, deploy-rs, agenix, nixos-generators, homepage, dotfiles
|
||||||
, pre-commit-hooks, ... }: {
|
, pre-commit-hooks, nix-minecraft, ... }: {
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
rotterdam = nixpkgs.lib.nixosSystem {
|
rotterdam = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
@ -93,7 +98,12 @@
|
||||||
unstable = nixpkgs.legacyPackages.x86_64-linux;
|
unstable = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
nixpkgs.overlays = [ unstable-overlay agenix.overlays.default ];
|
nixpkgs.overlays = [
|
||||||
|
unstable-overlay
|
||||||
|
agenix.overlays.default
|
||||||
|
nix-minecraft.overlay
|
||||||
|
];
|
||||||
|
imports = [ nix-minecraft.nixosModules.minecraft-servers ];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "alexandria";
|
hostName = "alexandria";
|
||||||
firewall = {
|
firewall = {
|
||||||
allowedTCPPorts = [ 80 443 8010 9666 25565 ];
|
allowedTCPPorts = [ 80 443 8010 9666 ];
|
||||||
allowedUDPPorts = [ 24454 ];
|
allowedUDPPorts = [ 24454 ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./jellyfin.nix
|
./jellyfin.nix
|
||||||
./librespeed.nix
|
./librespeed.nix
|
||||||
# ./minecraft.nix
|
./minecraft.nix
|
||||||
./nginx.nix
|
./nginx.nix
|
||||||
./paperless.nix
|
./paperless.nix
|
||||||
./searx.nix
|
./searx.nix
|
||||||
|
|
@ -20,6 +20,5 @@
|
||||||
./users.nix
|
./users.nix
|
||||||
./variables.nix
|
./variables.nix
|
||||||
./vaultwarden.nix
|
./vaultwarden.nix
|
||||||
# ./whoogle.nix
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,33 @@
|
||||||
{ inputs, config, pkgs, lib, ... }:
|
{ inputs, config, pkgs, lib, ... }:
|
||||||
|
|
||||||
{
|
let
|
||||||
services.minecraft-server = {
|
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;
|
enable = true;
|
||||||
eula = 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";
|
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";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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}";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue