From 3b53bbf60eef3d1b320d04f77871c7e8f9721b65 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Fri, 16 Aug 2024 09:02:44 -0300 Subject: [PATCH 01/10] services: add minecraft server --- flake.lock | 90 +++++++++++++++++++++++++++++++++- flake.nix | 2 + nixos.nix | 1 + services/minecraft/default.nix | 49 ++++++++++++++++++ services/minecraft/ops.json | 7 +++ 5 files changed, 147 insertions(+), 2 deletions(-) create mode 100644 services/minecraft/default.nix create mode 100644 services/minecraft/ops.json diff --git a/flake.lock b/flake.lock index 604b7af..6eba3b4 100644 --- a/flake.lock +++ b/flake.lock @@ -34,6 +34,22 @@ } }, "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-compat_2": { "flake": false, "locked": { "lastModified": 1696426674, @@ -49,6 +65,24 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": "systems_2" + }, + "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": [ @@ -231,6 +265,26 @@ "type": "github" } }, + "nix-minecraft": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1723685111, + "narHash": "sha256-vQiq7jAdF1ePFJjk67jYCpJagi1zzKGiyR3hHPrabzE=", + "owner": "Infinidoge", + "repo": "nix-minecraft", + "rev": "e13ed71bc4b9625e4b2779f328cb103b86c84da4", + "type": "github" + }, + "original": { + "owner": "Infinidoge", + "repo": "nix-minecraft", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1723175592, @@ -248,6 +302,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1715266358, + "narHash": "sha256-doPgfj+7FFe9rfzWo1siAV2mVCasW+Bh8I1cToAXEE4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "f1010e0469db743d14519a1efd37e23f8513d714", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1723362943, "narHash": "sha256-dFZRVSgmJkyM0bkPpaYRtG/kRMRTorUIDj8BxoOt1T4=", @@ -267,13 +337,14 @@ "inputs": { "home-manager": "home-manager", "hyprland": "hyprland", - "nixpkgs": "nixpkgs_2", + "nix-minecraft": "nix-minecraft", + "nixpkgs": "nixpkgs_3", "spicetify-nix": "spicetify-nix" } }, "spicetify-nix": { "inputs": { - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "nixpkgs": [ "nixpkgs" ] @@ -307,6 +378,21 @@ "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" + } + }, "xdph": { "inputs": { "hyprland-protocols": "hyprland-protocols", diff --git a/flake.nix b/flake.nix index fec26b5..cd5b946 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,8 @@ }; hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; + + nix-minecraft.url = "github:Infinidoge/nix-minecraft"; }; outputs = diff --git a/nixos.nix b/nixos.nix index 703e288..564c474 100644 --- a/nixos.nix +++ b/nixos.nix @@ -24,6 +24,7 @@ in ./services/archi.nix ./services/caddy.nix ./services/jellyfin.nix + ./services/minecraft ]; # Enable experimental features diff --git a/services/minecraft/default.nix b/services/minecraft/default.nix new file mode 100644 index 0000000..3494d42 --- /dev/null +++ b/services/minecraft/default.nix @@ -0,0 +1,49 @@ +{ pkgs, nix-minecraft, ... }: + +let + modpack = pkgs.fetchPackwizModpack { + url = "http://files.thewizard.link/horror/pack.toml"; + packHash = "sha256-Huqdl1nGMJC/hvkK8HKxOMHectFioY7zaNeT+D6Ur/8="; + }; +in +{ + imports = [ nix-minecraft.nixosModules.minecraft-servers ]; + nixpkgs.overlays = [ nix-minecraft.overlay ]; + + # Needed to package modpacks. + environment.systemPackages = [ pkgs.packwiz ]; + + services.minecraft-servers = { + enable = true; + eula = true; + openFirewall = true; + + servers = { + horror = { + enable = true; + package = pkgs.fabricServers.fabric-1_20_6; + autoStart = true; + + jvmOpts = "-Xms512M -Xmx8192M"; + + serverProperties = { + allow-flight = true; + difficulty = "normal"; + enforce-secure-profile = true; + level-name = "horror"; + motd = "\\u00A70Are you a hero?\\u00A7r"; + pvp = true; + resource-pack = "https://cdn.modrinth.com/data/p1WH6sHr/versions/3lQn31SZ/From-The-Fog-1.20.5-1.20.6-v1.9.3-Data-Resource-Pack.zip"; + server-ip = "192.168.0.100"; + server-port = 25565; + view-distance = 16; + }; + + symlinks = { + mods = "${modpack}/mods"; + "ops.json" = ./ops.json; + }; + }; + }; + }; +} diff --git a/services/minecraft/ops.json b/services/minecraft/ops.json new file mode 100644 index 0000000..0492ee5 --- /dev/null +++ b/services/minecraft/ops.json @@ -0,0 +1,7 @@ +[ + { + "uuid": "55a58451-8fe9-4dfe-8011-1509e948e7a6", + "name": "WizardlinK", + "level": 4 + } +] From 10aa3c6c9a97aa86f4c99c1d4bd4cee7d8a82d7c Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Fri, 16 Aug 2024 09:03:20 -0300 Subject: [PATCH 02/10] caddy: add files.thewizard.link --- services/caddy.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/caddy.nix b/services/caddy.nix index 410741e..db51514 100644 --- a/services/caddy.nix +++ b/services/caddy.nix @@ -25,5 +25,10 @@ flush_interval -1 } ''; + + virtualHosts."files.thewizard.link".extraConfig = '' + root * /srv/files + file_server + ''; }; } From 98ff3c4dd87c3c76855cb4eef46a98ebb7bb5bf8 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Mon, 19 Aug 2024 20:33:05 -0300 Subject: [PATCH 03/10] services: add gitea --- nixos.nix | 1 + services/gitea.nix | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 services/gitea.nix diff --git a/nixos.nix b/nixos.nix index 564c474..49c48fa 100644 --- a/nixos.nix +++ b/nixos.nix @@ -23,6 +23,7 @@ in # Include service configuration ./services/archi.nix ./services/caddy.nix + ./services/gitea.nix ./services/jellyfin.nix ./services/minecraft ]; diff --git a/services/gitea.nix b/services/gitea.nix new file mode 100644 index 0000000..fb92f6a --- /dev/null +++ b/services/gitea.nix @@ -0,0 +1,14 @@ +{ + services.gitea = { + enable = true; + + lfs.enable = true; + + settings = { + server = { + HTTP_PORT = 3788; + ROOT_URL = "https://git.thewizard.link"; + }; + }; + }; +} From b0f5c30aaf9f2cd40972a876c2d6eb2e7e2d25b9 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Mon, 19 Aug 2024 20:33:28 -0300 Subject: [PATCH 04/10] caddy: add git.thewizard.link --- services/caddy.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/caddy.nix b/services/caddy.nix index db51514..d36ff39 100644 --- a/services/caddy.nix +++ b/services/caddy.nix @@ -26,6 +26,11 @@ } ''; + + virtualHosts."git.thewizard.link".extraConfig = '' + reverse_proxy 127.0.0.1:3788 + ''; + virtualHosts."files.thewizard.link".extraConfig = '' root * /srv/files file_server From d649bd5a32b447f03d60062dfe7eadc70cde1675 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Mon, 19 Aug 2024 20:33:45 -0300 Subject: [PATCH 05/10] jellyfin: implement the skip intro patch --- services/jellyfin.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/services/jellyfin.nix b/services/jellyfin.nix index 5b5f683..badc27a 100644 --- a/services/jellyfin.nix +++ b/services/jellyfin.nix @@ -1,8 +1,27 @@ +{ pkgs, ... }: + { services.jellyfin = { enable = true; openFirewall = true; user = "wizardlink"; + package = pkgs.jellyfin.override { + jellyfin-web = pkgs.jellyfin-web.overrideAttrs ( + final: prev: { + installPhase = '' + runHook preInstall + + # Inject the skip intro button script. + sed -i "s###" dist/index.html + + mkdir -p $out/share + cp -a dist $out/share/jellyfin-web + + runHook postInstall + ''; + } + ); + }; }; services.jellyseerr = { From 2e2f675d01ed0ba4a416e86972a91e4075688748 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Mon, 19 Aug 2024 20:34:04 -0300 Subject: [PATCH 06/10] thunar: add thunar-archive-plugin --- nixos.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nixos.nix b/nixos.nix index 49c48fa..3732f65 100644 --- a/nixos.nix +++ b/nixos.nix @@ -307,7 +307,10 @@ in }; # Enable Thunar and it's dependencies - programs.thunar.enable = true; + programs.thunar = { + enable = true; + plugins = with pkgs.xfce; [ thunar-archive-plugin ]; + }; programs.xfconf.enable = true; # For configuring services.gvfs.enable = true; # For mounting drives, trash, etc. services.tumbler.enable = true; # Thumbnail support From ba7b0a8f9f67f9c79be74f659c766b63b746d1cd Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Mon, 19 Aug 2024 20:34:14 -0300 Subject: [PATCH 07/10] nixos: add myself to the minecraft group --- nixos.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos.nix b/nixos.nix index 3732f65..b7143fc 100644 --- a/nixos.nix +++ b/nixos.nix @@ -170,6 +170,7 @@ in "docker" "gamemode" "libvirtd" + "minecraft" "networkmanager" "openrazer" "postgresql" From 893aab43b82bd74aefddbfd05b29c707f5766a0f Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Mon, 19 Aug 2024 20:34:26 -0300 Subject: [PATCH 08/10] nixos: allow the minecraft simple voice chat udp port --- nixos.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos.nix b/nixos.nix index b7143fc..4426c76 100644 --- a/nixos.nix +++ b/nixos.nix @@ -127,6 +127,7 @@ in ]; allowedUDPPorts = [ + 24454 # Minecraft Simple Voice Chat 2626 # Dolphin emulator 27015 # Source games 28910 # Heretic II From 9d1256ada03c4c10ddf660023ba7121847148142 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Mon, 19 Aug 2024 20:34:51 -0300 Subject: [PATCH 09/10] minecraft: update to modpack 1.0.5 and add map.thewizard.link to caddy --- services/caddy.nix | 3 +++ services/minecraft/default.nix | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/services/caddy.nix b/services/caddy.nix index d36ff39..6eba4fe 100644 --- a/services/caddy.nix +++ b/services/caddy.nix @@ -26,6 +26,9 @@ } ''; + virtualHosts."map.thewizard.link".extraConfig = '' + reverse_proxy 192.168.0.100:8123 + ''; virtualHosts."git.thewizard.link".extraConfig = '' reverse_proxy 127.0.0.1:3788 diff --git a/services/minecraft/default.nix b/services/minecraft/default.nix index 3494d42..1ddf6dd 100644 --- a/services/minecraft/default.nix +++ b/services/minecraft/default.nix @@ -2,8 +2,8 @@ let modpack = pkgs.fetchPackwizModpack { - url = "http://files.thewizard.link/horror/pack.toml"; - packHash = "sha256-Huqdl1nGMJC/hvkK8HKxOMHectFioY7zaNeT+D6Ur/8="; + url = "http://files.thewizard.link/minecraft/pack.toml"; + packHash = "sha256-oBCLVNLaBwF7Nv1PMEzNmzSv6khcRIOLfOX9chZPI+Y="; }; in { @@ -19,19 +19,19 @@ in openFirewall = true; servers = { - horror = { + silly-pack = { enable = true; - package = pkgs.fabricServers.fabric-1_20_6; + package = pkgs.fabricServers.fabric-1_20_1.override { loaderVersion = "0.15.11"; }; autoStart = true; - jvmOpts = "-Xms512M -Xmx8192M"; + jvmOpts = "-Xms512M -Xmx10112M -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=4M -XX:TargetSurvivorRatio=90 -XX:G1NewSizePercent=50 -XX:G1MaxNewSizePercent=80 -XX:InitiatingHeapOccupancyPercent=10 -XX:G1MixedGCLiveThresholdPercent=50"; serverProperties = { allow-flight = true; difficulty = "normal"; enforce-secure-profile = true; level-name = "horror"; - motd = "\\u00A70Are you a hero?\\u00A7r"; + motd = "\\u00A70Ready to run?\\u00A7r"; pvp = true; resource-pack = "https://cdn.modrinth.com/data/p1WH6sHr/versions/3lQn31SZ/From-The-Fog-1.20.5-1.20.6-v1.9.3-Data-Resource-Pack.zip"; server-ip = "192.168.0.100"; From e9a14153095580a43b409891c14a39a643097079 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Mon, 19 Aug 2024 21:08:42 -0300 Subject: [PATCH 10/10] gitea -> forgejo --- nixos.nix | 2 +- services/{gitea.nix => forgejo.nix} | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) rename services/{gitea.nix => forgejo.nix} (74%) diff --git a/nixos.nix b/nixos.nix index 4426c76..93c53c1 100644 --- a/nixos.nix +++ b/nixos.nix @@ -23,7 +23,7 @@ in # Include service configuration ./services/archi.nix ./services/caddy.nix - ./services/gitea.nix + ./services/forgejo.nix ./services/jellyfin.nix ./services/minecraft ]; diff --git a/services/gitea.nix b/services/forgejo.nix similarity index 74% rename from services/gitea.nix rename to services/forgejo.nix index fb92f6a..dc78937 100644 --- a/services/gitea.nix +++ b/services/forgejo.nix @@ -1,11 +1,12 @@ { - services.gitea = { + services.forgejo = { enable = true; lfs.enable = true; settings = { server = { + DISABLE_REGISTRATION = true; HTTP_PORT = 3788; ROOT_URL = "https://git.thewizard.link"; };