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..93c53c1 100644 --- a/nixos.nix +++ b/nixos.nix @@ -23,7 +23,9 @@ in # Include service configuration ./services/archi.nix ./services/caddy.nix + ./services/forgejo.nix ./services/jellyfin.nix + ./services/minecraft ]; # Enable experimental features @@ -125,6 +127,7 @@ in ]; allowedUDPPorts = [ + 24454 # Minecraft Simple Voice Chat 2626 # Dolphin emulator 27015 # Source games 28910 # Heretic II @@ -168,6 +171,7 @@ in "docker" "gamemode" "libvirtd" + "minecraft" "networkmanager" "openrazer" "postgresql" @@ -305,7 +309,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 diff --git a/services/caddy.nix b/services/caddy.nix index 410741e..6eba4fe 100644 --- a/services/caddy.nix +++ b/services/caddy.nix @@ -25,5 +25,18 @@ flush_interval -1 } ''; + + virtualHosts."map.thewizard.link".extraConfig = '' + reverse_proxy 192.168.0.100:8123 + ''; + + virtualHosts."git.thewizard.link".extraConfig = '' + reverse_proxy 127.0.0.1:3788 + ''; + + virtualHosts."files.thewizard.link".extraConfig = '' + root * /srv/files + file_server + ''; }; } diff --git a/services/forgejo.nix b/services/forgejo.nix new file mode 100644 index 0000000..dc78937 --- /dev/null +++ b/services/forgejo.nix @@ -0,0 +1,15 @@ +{ + services.forgejo = { + enable = true; + + lfs.enable = true; + + settings = { + server = { + DISABLE_REGISTRATION = true; + HTTP_PORT = 3788; + ROOT_URL = "https://git.thewizard.link"; + }; + }; + }; +} 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 = { diff --git a/services/minecraft/default.nix b/services/minecraft/default.nix new file mode 100644 index 0000000..1ddf6dd --- /dev/null +++ b/services/minecraft/default.nix @@ -0,0 +1,49 @@ +{ pkgs, nix-minecraft, ... }: + +let + modpack = pkgs.fetchPackwizModpack { + url = "http://files.thewizard.link/minecraft/pack.toml"; + packHash = "sha256-oBCLVNLaBwF7Nv1PMEzNmzSv6khcRIOLfOX9chZPI+Y="; + }; +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 = { + silly-pack = { + enable = true; + package = pkgs.fabricServers.fabric-1_20_1.override { loaderVersion = "0.15.11"; }; + autoStart = true; + + 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 = "\\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"; + 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 + } +]