|
| 1 | +{ |
| 2 | + lib, |
| 3 | + stdenv, |
| 4 | + fetchzip, |
| 5 | + buildFHSEnv, |
| 6 | + makeWrapper, |
| 7 | + makeDesktopItem, |
| 8 | + writeScript, |
| 9 | + gtk3, |
| 10 | + nss, |
| 11 | + libsecret, |
| 12 | + libsoup_3, |
| 13 | + gdk-pixbuf, |
| 14 | + glib, |
| 15 | + webkitgtk_4_1, |
| 16 | + xdg-utils, |
| 17 | + temurin-bin-25, |
| 18 | + libGL, |
| 19 | + alsa-lib, |
| 20 | + udev, |
| 21 | + libx11, |
| 22 | + libxcursor, |
| 23 | + libxrandr, |
| 24 | + libxi, |
| 25 | + icu, |
| 26 | + openssl, |
| 27 | +}: |
| 28 | + |
| 29 | +let |
| 30 | + version = "2026.01.24-997c2cb"; |
| 31 | + |
| 32 | + # TODO: add icon once a stable versioned source is available |
| 33 | + desktopItem = makeDesktopItem { |
| 34 | + name = "hytale-launcher"; |
| 35 | + desktopName = "Hytale Launcher"; |
| 36 | + exec = "hytale-launcher"; |
| 37 | + comment = "Official launcher for Hytale"; |
| 38 | + categories = [ "Game" ]; |
| 39 | + terminal = false; |
| 40 | + startupWMClass = "com.hypixel.HytaleLauncher"; |
| 41 | + }; |
| 42 | + |
| 43 | + sources = { |
| 44 | + x86_64-linux = { |
| 45 | + url = "https://launcher.hytale.com/builds/release/linux/amd64/hytale-launcher-${version}.zip"; |
| 46 | + hash = "sha256-p+x+dNEhMDnjVpyzrczxP/KiYkFrbU8sqbIvwtuEN80="; |
| 47 | + }; |
| 48 | + aarch64-darwin = { |
| 49 | + url = "https://launcher.hytale.com/builds/release/darwin/arm64/hytale-launcher-${version}.zip"; |
| 50 | + hash = "sha256-txi54x7v4cZrlag+ICGnaLBTrpPE3Q9xeZwzFpoOYE0="; |
| 51 | + }; |
| 52 | + }; |
| 53 | + |
| 54 | + currentSource = |
| 55 | + sources.${stdenv.hostPlatform.system} |
| 56 | + or (throw "unsupported system: ${stdenv.hostPlatform.system}"); |
| 57 | + |
| 58 | + src = fetchzip { |
| 59 | + inherit (currentSource) url hash; |
| 60 | + stripRoot = false; |
| 61 | + }; |
| 62 | + |
| 63 | + fhsEnv = buildFHSEnv { |
| 64 | + pname = "hytale-launcher"; |
| 65 | + inherit version; |
| 66 | + |
| 67 | + targetPkgs = pkgs: [ |
| 68 | + # launcher dependencies (webkit/tauri) |
| 69 | + gtk3 |
| 70 | + nss |
| 71 | + libsecret |
| 72 | + libsoup_3 |
| 73 | + gdk-pixbuf |
| 74 | + glib |
| 75 | + webkitgtk_4_1 |
| 76 | + xdg-utils |
| 77 | + # java runtime for the game (temurin 25 recommended by official docs) |
| 78 | + temurin-bin-25 |
| 79 | + # graphics |
| 80 | + libGL |
| 81 | + # audio |
| 82 | + alsa-lib |
| 83 | + # input/display |
| 84 | + udev |
| 85 | + libx11 |
| 86 | + libxcursor |
| 87 | + libxrandr |
| 88 | + libxi |
| 89 | + # .NET runtime dependencies :( |
| 90 | + icu |
| 91 | + openssl |
| 92 | + # misc |
| 93 | + stdenv.cc.cc.lib |
| 94 | + ]; |
| 95 | + |
| 96 | + runScript = "${src}/hytale-launcher"; |
| 97 | + |
| 98 | + extraBwrapArgs = [ |
| 99 | + "--setenv __NV_DISABLE_EXPLICIT_SYNC 1" |
| 100 | + "--setenv WEBKIT_DISABLE_DMABUF_RENDERER 1" |
| 101 | + # taken from the flatpak at https://launcher.hytale.com/builds/release/linux/amd64/hytale-launcher-latest.flatpak |
| 102 | + "--setenv WEBKIT_DISABLE_COMPOSITING_MODE 1" |
| 103 | + "--setenv DESKTOP_STARTUP_ID com.hypixel.HytaleLauncher" |
| 104 | + "--setenv JAVA_HOME ${temurin-bin-25}" |
| 105 | + ]; |
| 106 | + |
| 107 | + extraInstallCommands = '' |
| 108 | + mkdir -p $out/share/applications |
| 109 | + cp ${desktopItem}/share/applications/*.desktop $out/share/applications/ |
| 110 | + ''; |
| 111 | + |
| 112 | + passthru = { |
| 113 | + inherit src; |
| 114 | + updateScript = ./update.sh; |
| 115 | + }; |
| 116 | + |
| 117 | + meta = { |
| 118 | + description = "Official launcher for Hytale"; |
| 119 | + longDescription = '' |
| 120 | + Official launcher for Hytale, an upcoming block-based game from Hypixel Studios. |
| 121 | +
|
| 122 | + Note: The launcher's built-in auto-update mechanism will not work on NixOS |
| 123 | + due to the immutable nature of the Nix store. You may see an error message |
| 124 | + about "failed to remove existing executable: read-only file system", this |
| 125 | + is expected and the launcher will continue to work. Updates must be applied |
| 126 | + by updating the nixpkgs package. |
| 127 | + ''; |
| 128 | + homepage = "https://hytale.com"; |
| 129 | + license = lib.licenses.unfreeRedistributable; |
| 130 | + maintainers = with lib.maintainers; [ |
| 131 | + gepbird |
| 132 | + karol-broda |
| 133 | + liquidnya |
| 134 | + ]; |
| 135 | + mainProgram = "hytale-launcher"; |
| 136 | + platforms = [ |
| 137 | + "x86_64-linux" |
| 138 | + "aarch64-darwin" |
| 139 | + ]; |
| 140 | + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; |
| 141 | + }; |
| 142 | + }; |
| 143 | + |
| 144 | + darwinPackage = stdenv.mkDerivation { |
| 145 | + pname = "hytale-launcher"; |
| 146 | + inherit version src; |
| 147 | + |
| 148 | + nativeBuildInputs = [ makeWrapper ]; |
| 149 | + |
| 150 | + installPhase = '' |
| 151 | + runHook preInstall |
| 152 | + mkdir -p "$out/Applications" "$out/bin" |
| 153 | + cp -r hytale-launcher.app "$out/Applications/" |
| 154 | + makeWrapper "$out/Applications/hytale-launcher.app/Contents/MacOS/hytale-launcher" "$out/bin/hytale-launcher" |
| 155 | + runHook postInstall |
| 156 | + ''; |
| 157 | + |
| 158 | + inherit (fhsEnv) passthru meta; |
| 159 | + }; |
| 160 | +in |
| 161 | +if stdenv.hostPlatform.isDarwin then darwinPackage else fhsEnv |
0 commit comments