diff --git a/bikeability2.nix b/bikeability2.nix deleted file mode 100644 index 7898800..0000000 --- a/bikeability2.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ pkgs, config, lib, ... }: -let - wordpressPort = 5781; -in -{ - config = lib.mkMerge [ - (lib.mkIf (config.networking.hostName == "nixnas") { - services.wordpress.sites."bikeability.net" = { - virtualHost.listen = [{ - port = wordpressPort; - ip = "127.0.0.1"; - }]; - settings = { - FORCE_SSL_ADMIN = true; - }; - extraConfig = '' - $_SERVER['HTTPS']='on'; - ''; - plugins = { - wpcode = pkgs.stdenv.mkDerivation rec { - name = "wpcode"; - version = "2.3.3"; - src = pkgs.fetchzip { - url = "https://downloads.wordpress.org/plugins/insert-headers-and-footers.${version}.zip"; - hash = "sha256-BjQ62ZvWck/e0kcP6Ny1pOGAfsPVUDQLrvGnvkeq6FY="; - }; - installPhase = "mkdir -p $out; cp -R * $out/"; - }; - }; - }; - services.cloudflared.tunnels.mine.ingress."bikeability.net" = "http://127.0.0.1:${builtins.toString wordpressPort}"; - }) - ]; -} diff --git a/cloudflared.nix b/cloudflared.nix deleted file mode 100644 index 6a3b6c3..0000000 --- a/cloudflared.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ config, lib, ... }: -{ - config = lib.mkMerge [ - (lib.mkIf (config.networking.hostName == "nixnas") { - services.cloudflared = { - enable = true; - certificateFile = "/Block/cloudflare/cert.pem"; - tunnels.mine = { - credentialsFile = "/Block/cloudflare/2d530440-2db8-491a-bb61-7941315d4cb9.json"; - default = "http_status:404"; - }; - }; - }) - ]; -} diff --git a/cos.nix b/cos.nix index 5a37efa..6fac4f9 100644 --- a/cos.nix +++ b/cos.nix @@ -11,10 +11,8 @@ ./emacs.nix ./minecraft/minecraft-servers.nix ./mastodon.nix - ./cloudflared.nix - ./umami.nix - ./bikeability2.nix "${inputs.home-manager}/nixos" + inputs.nix-minecraft.nixosModules.minecraft-servers ]; options.cos = { diff --git a/loadedskypotato/configuration.nix b/loadedskypotato/configuration.nix index 99c7f75..82b97a1 100644 --- a/loadedskypotato/configuration.nix +++ b/loadedskypotato/configuration.nix @@ -123,6 +123,17 @@ in }; }; + services.nginx.streamConfig = '' + server { + listen 25565 reuseport; + proxy_pass 10.100.0.2:25565; + } + server { + listen 25566 reuseport; + proxy_pass 10.100.0.2:25566; + } + ''; + services.dnsmasq = { enable = true; settings = { @@ -147,6 +158,10 @@ in usePredictableInterfaceNames = false; useDHCP = false; firewall = { + allowedTCPPorts = [ + 25565 # minecraft survival + 25566 # minecraft creative + ]; allowedUDPPorts = [ 51820 # wireguard ]; diff --git a/minecraft/minecraft-servers.nix b/minecraft/minecraft-servers.nix index f55e538..923fac9 100644 --- a/minecraft/minecraft-servers.nix +++ b/minecraft/minecraft-servers.nix @@ -1,8 +1,7 @@ -{ config, lib, pkgs, inputs, ... }: +{ config, lib, pkgs, ... }: let survivalPort = 25565; creativePort = 25566; - cobblemonPort = 25567; users = { clay53_clayton = "bc2653cd-6cb1-4d15-9d24-cce0d1e8811c"; fire_chase = "c2b1a7ff-abff-41cb-af2a-4a89e942d288"; @@ -24,15 +23,8 @@ let maxRam = "1G"; in { - imports = [ - inputs.nix-minecraft.nixosModules.minecraft-servers - ]; config = lib.mkMerge [ (lib.mkIf (config.networking.hostName == "nixnas") { - nixpkgs.overlays = [ - inputs.nix-minecraft.overlay - ]; - services.minecraft-servers = { enable = true; eula = true; @@ -54,7 +46,7 @@ in motd = "Clayton Hickey's Survival"; white-list = true; }; - package = pkgs.vanillaServers.vanilla-1_21_11; + package = pkgs.minecraftServers.vanilla-1_21_11; jvmOpts = "-Xms${minRam} -Xmx${maxRam}"; }; @@ -72,63 +64,13 @@ in motd = "Clayton Hickey's Creative"; white-list = true; }; - package = pkgs.vanillaServers.vanilla-1_21_11; + package = pkgs.minecraftServers.vanilla-1_21_11; jvmOpts = "-Xms${minRam} -Xmx${maxRam}"; }; - services.minecraft-servers.servers.cobblemon = - let - inherit (inputs.nix-minecraft.lib) collectFilesAt; - modpack = pkgs.fetchPackwizModpack { - url = "https://forgejo.claytonhickey.me/clay53/cobblemon-modpack/raw/branch/master/pack.toml"; - packHash = "sha256-rz51hV1kgju7+6OyeEzSwO4+fmoS4/bi0Fo9iCYBOnI="; - }; - in - { - enable = true; - autoStart = true; - restart = "always"; - enableReload = false; - whitelist = defaultWhitelist; - operators = defaultOperators; - serverProperties = { - server-port = cobblemonPort; - difficulty = 3; - gamemode = 0; - motd = "Clayton Hickey's Cobblemon"; - white-list = true; - }; - package = pkgs.fabricServers.fabric-1_21_1; - symlinks = collectFilesAt modpack "mods"; - }; - networking.firewall.interfaces.${config.cos.wireguard.interface}.allowedTCPPorts = [ survivalPort creativePort - cobblemonPort - ]; - }) - - (lib.mkIf (config.networking.hostName == "loadedskypotato") { - services.nginx.streamConfig = '' - server { - listen ${survivalPort} reuseport; - proxy_pass 10.100.0.2:${survivalPort}; - } - server { - listen ${creativePort} reuseport; - proxy_pass 10.100.0.2:${creativePort}; - } - server { - listen ${cobblemonPort} reuseport; - proxy_pass 10.100.0.2:${cobblemonPort}; - } - ''; - - networking.firewall.allowedTCPPorts = [ - survivalPort - creativePort - cobblemonPort ]; }) ]; diff --git a/umami.nix b/umami.nix index 15e45be..430b4dd 100644 --- a/umami.nix +++ b/umami.nix @@ -9,11 +9,10 @@ in enable = true; settings = { APP_SECRET_FILE = "/Block/umami/app_secret.txt"; - HOSTNAME = "127.0.0.1"; + HOSTNAME = config.cos.wireguard.clientInternalIP; PORT = umamiPort; }; }; - services.cloudflared.tunnels.mine.ingress."umami.claytonhickey.me" = "http://127.0.0.1:${builtins.toString umamiPort}"; }) ]; }