diff --git a/flake.lock b/flake.lock index 8bdb425..2293647 100644 --- a/flake.lock +++ b/flake.lock @@ -84,6 +84,40 @@ "type": "github" } }, + "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": { + "inputs": { + "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" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -125,6 +159,28 @@ "type": "github" } }, + "nix-minecraft": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701134457, + "narHash": "sha256-NZubVgyrmGZ0P3K7UveD3viUIhP4qDVXw61UU9Nx9yQ=", + "owner": "Infinidoge", + "repo": "nix-minecraft", + "rev": "ef3f7a27dfc17d16ed35c29927f0b0ec0e260e06", + "type": "github" + }, + "original": { + "owner": "Infinidoge", + "repo": "nix-minecraft", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1700559156, @@ -163,12 +219,28 @@ "aurora-blog-template": "aurora-blog-template", "denbot": "denbot", "home-manager": "home-manager_2", + "nix-minecraft": "nix-minecraft", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "todos": "todos", "website": "website" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "todos": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 124d06a..3626332 100644 --- a/flake.nix +++ b/flake.nix @@ -28,9 +28,13 @@ url = "github:ryantm/agenix"; inputs.nixpkgs.follows = "nixpkgs"; }; + nix-minecraft = { + url = "github:Infinidoge/nix-minecraft"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = inputs@{ nixpkgs, home-manager, nixos-hardware, ... }: { + outputs = inputs@{ nixpkgs, home-manager, ... }: { nixosConfigurations = let mkSystem = entrypoint: nixpkgs.lib.nixosSystem { system = "x86_64-linux"; diff --git a/nixos-configurations/server/default.nix b/nixos-configurations/server/default.nix index 4918075..17a92d9 100644 --- a/nixos-configurations/server/default.nix +++ b/nixos-configurations/server/default.nix @@ -3,10 +3,13 @@ { imports = [ inputs.agenix.nixosModules.default + inputs.nix-minecraft.nixosModules.minecraft-servers ./hardware-configuration.nix ../shared.nix ]; + nixpkgs.overlays = [ inputs.nix-minecraft.overlay ]; + nix.settings.trusted-users = [ "thiloho" ]; age.secrets.hedgedoc-environment-file.file = ../../secrets/hedgedoc-environment-file.age; @@ -30,22 +33,100 @@ enable = true; settings.PasswordAuthentication = false; }; - minecraft-server = { + minecraft-servers = { enable = true; eula = true; - declarative = true; - openFirewall = true; - whitelist = { - thilo_ho = "4e4d744d-7748-46bc-add8-b3e8ca3b4cf5"; - PegasusIsHere = "24155f74-eb04-4f45-a743-f2b7eb71c6a2"; - BakaZaps = "1888532c-6df7-4514-b96a-99ed4e7684f2"; - Liaxswan = "ccbf3468-a6b4-4d7b-9837-5a2451deca79"; - }; - serverProperties = { - difficulty = 3; - max-players = 10; - motd = "Minecraft server of Thilo."; - white-list = true; + servers = { + thilo = { + enable = true; + autoStart = true; + package = pkgs.paperServers.paper; + openFirewall = true; + enableReload = true; + whitelist = { + thilo_ho = "4e4d744d-7748-46bc-add8-b3e8ca3b4cf5"; + PegasusIsHere = "24155f74-eb04-4f45-a743-f2b7eb71c6a2"; + BakaZaps = "1888532c-6df7-4514-b96a-99ed4e7684f2"; + Liaxswan = "ccbf3468-a6b4-4d7b-9837-5a2451deca79"; + }; + serverProperties = { + difficulty = 3; + max-players = 10; + motd = "Minecraft server of Thilo."; + white-list = true; + }; + files = { + "ops.json".value = [ + { + uuid = "4e4d744d-7748-46bc-add8-b3e8ca3b4cf5"; + name = "thilo_ho"; + level = 4; + } + ]; + "plugins/TAB/config.yml".value = { + header-footer = { + enabled = true; + header = [ + "<#FFFFFF>&mx x" + "" + "&aThilo's survival server" + "&7Online players: &f%online%" + "" + ]; + footer = [ + "" + "<#FFFFFF>&mx x" + ]; + }; + }; + "plugins/TAB/groups.yml".value = { + _DEFAULT_ = { + tabprefix = "%luckperms-prefix%"; + tagprefix = "%luckperms-prefix%"; + tabsuffix = "%luckperms-suffix%"; + tagsuffix = "%luckperms-suffix%"; + }; + }; + "plugins/Essentials/config.yml".value = { + ops-name-color = "7"; + chat = { + format = "{PREFIX}{USERNAME}&8: {SUFFIX}{MESSAGE}"; + }; + }; + }; + symlinks = { + "plugins/TAB.jar" = pkgs.fetchurl rec { + pname = "TAB"; + version = "4.0.9"; + url = "https://github.com/NEZNAMY/${pname}/releases/download/${version}/${pname}.v${version}.jar"; + sha256 = "sha256-xXr7Pc/T+6YfoFUpi2tq09FzCxRp/m8GFQs5qDMkqmc="; + }; + "plugins/LuckPerms.jar" = pkgs.fetchurl rec { + pname = "LuckPerms"; + version = "5.4.108"; + url = "https://download.luckperms.net/1521/bukkit/loader/LuckPerms-Bukkit-${version}.jar"; + sha256 = "sha256-TN7HH/5JiG98xBACfuoJZILsiDxU8WX5laNDS3h+qR4="; + }; + "plugins/Vault.jar" = pkgs.fetchurl { + pname = "Vault"; + version = "1.7.3"; + url = "https://dev.bukkit.org/projects/vault/files/latest"; + sha256 = "sha256-prXtl/Q6XPW7rwCnyM0jxa/JvQA/hJh1r4s25s930B0="; + }; + "plugins/EssentialsX.jar" = pkgs.fetchurl rec { + pname = "EssentialsX"; + version = "2.20.1"; + url = "https://github.com/EssentialsX/Essentials/releases/download/${version}/EssentialsX-${version}.jar"; + sha256 = "sha256-gC6jC9pGDKRZfoGJJYFpM8EjsI2BJqgU+sKNA6Yb9UI="; + }; + "plugins/EssentialsXChat.jar" = pkgs.fetchurl rec { + pname = "EssentialsXChat"; + version = "2.20.1"; + url = "https://github.com/EssentialsX/Essentials/releases/download/${version}/EssentialsXChat-${version}.jar"; + sha256 = "sha256-QKpcICQc6zAH68tc+/Gb8sRnsMCQrlDnBlPuh6t3XKY="; + }; + }; + }; }; }; terraria = { diff --git a/nixos-configurations/shared-desktop.nix b/nixos-configurations/shared-desktop.nix index 4d8f0fe..da1d343 100644 --- a/nixos-configurations/shared-desktop.nix +++ b/nixos-configurations/shared-desktop.nix @@ -25,6 +25,7 @@ enableSSHSupport = true; pinentryFlavor = "gnome3"; }; + java.enable = true; }; hardware.pulseaudio.enable = false;