Skip to content

Commit 83e96c1

Browse files
committed
feat: add hytale
1 parent aef0ae3 commit 83e96c1

File tree

4 files changed

+226
-0
lines changed

4 files changed

+226
-0
lines changed

home/apps/gaming/default.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
imports = [
44
./artix-game-launcher
55
./godot
6+
./hytale
67
./minecraft
78
./unity
89
];
@@ -13,6 +14,7 @@
1314
config = lib.mkIf config.gaming.enable {
1415
artix-game-launcher.enable = lib.mkDefault true;
1516
godot.enable = lib.mkDefault false;
17+
hytale.enable = lib.mkDefault true;
1618
minecraft.enable = lib.mkDefault false;
1719
unity.enable = lib.mkDefault false;
1820
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
pkgs,
3+
lib,
4+
config,
5+
...
6+
}:
7+
{
8+
options = {
9+
hytale.enable = lib.mkEnableOption "Enable hytale module";
10+
};
11+
config = lib.mkIf config.hytale.enable {
12+
home = {
13+
packages = with pkgs; [
14+
(callPackage ../../../../pkgs/hytale.nix { })
15+
];
16+
};
17+
};
18+
}

pkgs/hytale.nix

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
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

pkgs/update.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env nix-shell
2+
#!nix-shell -I nixpkgs=./. -i bash -p bash curl cacert jq nix nix-prefetch common-updater-scripts
3+
4+
launcherJson=$(curl -s https://launcher.hytale.com/version/release/launcher.json)
5+
6+
function launcherJq() {
7+
echo "$launcherJson" | jq --raw-output "$@"
8+
}
9+
10+
latestVersion=$(launcherJq '.version')
11+
if [[ $latestVersion == "$UPDATE_NIX_OLD_VERSION" ]]; then
12+
echo "package is up-to-date"
13+
exit 0
14+
fi
15+
16+
function selectUrlAndHash() {
17+
local os="$1"
18+
local arch="$2"
19+
# shellcheck disable=SC2016
20+
launcherJq --arg os "$os" --arg arch "$arch" '[.download_url[$os][$arch].url, .download_url[$os][$arch].sha256] | join(" ")'
21+
}
22+
23+
function prefetch() {
24+
nix store prefetch-file --json --hash-type sha256 "$@" | jq --raw-output '[.hash, .storePath] | join(" ")'
25+
}
26+
27+
function fetchzipFile() {
28+
local file="$1"
29+
shift
30+
# keep a reference to the store path to keep it in the sandbox
31+
derivationArgs="{ src = builtins.storePath $(echo -n "$file" | jq -Rsa '.'); }"
32+
nix-prefetch -I nixpkgs=./. --quiet fetchzip --url "file://$file" --derivationArgs --expr "$derivationArgs" "$@"
33+
}
34+
35+
function update() {
36+
local system="$1"
37+
shift
38+
read -r url expectedHash < <(selectUrlAndHash "$@")
39+
read -r _zipHash zipPath < <(prefetch --expected-hash "$expectedHash" "$url")
40+
hash=$(fetchzipFile "$zipPath" --no-stripRoot)
41+
update-source-version --system="$system" --ignore-same-version hytale-launcher "$latestVersion" "$hash"
42+
}
43+
44+
update "x86_64-linux" "linux" "amd64"
45+
update "aarch64-darwin" "darwin" "arm64"

0 commit comments

Comments
 (0)