Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13836,6 +13836,12 @@
githubId = 32744028;
keys = [ { fingerprint = "7577 13A4 9609 0C2F 51C4 018C B5C8 89A2 F195 28F6"; } ];
};
karol-broda = {
email = "nix@karolbroda.com";
github = "karol-broda";
githubId = 122811026;
name = "Karol Broda";
};
karpfediem = {
name = "Karpfen";
github = "karpfediem";
Expand Down Expand Up @@ -15610,6 +15616,14 @@
githubId = 591860;
name = "Lionello Lunesu";
};
liquidnya = {
name = "Alice ✨🌙 Luna";
github = "liquidnya";
githubId = 7364785;
email = "alice@liquidnya.dev";
matrix = "@liquidnya:matrix.org";
keys = [ { fingerprint = "7C2D E075 FA93 D61C C9A7 876F 7966 C19E 32F9 EF06"; } ];
};
lisanna-dettwyler = {
email = "lisanna.dettwyler@gmail.com";
github = "lisanna-dettwyler";
Expand Down
100 changes: 100 additions & 0 deletions pkgs/by-name/hy/hytale-launcher/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
lib,
writeShellApplication,

coreutils,
curl,
flatpak,
libnotify,

copyDesktopItems,
makeDesktopItem,

extraEnvironment ? { },
...
}:
let
environment = {
__NV_DISABLE_EXPLICIT_SYNC = "1";
WEBKIT_DISABLE_DMABUF_RENDERER = "1";
DESKTOP_STARTUP_ID = "com.hypixel.HytaleLauncher";
}
// extraEnvironment;
toFlatpakEnvArg = (var: lib.escapeShellArg "--env=${var.name}=${var.value}");
in
writeShellApplication {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find any other packages directly using writeShellApplication at the top-level of a package so I'm not sure how this will interact with things like https://search.nixos.org/ as there is no package version. It might be worth switching to mkDerivation if possible, but it installs fine on my system just fine as is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under the hood writeShellApplication is just mkDerivation with a custom buildPhase... hence I can override derivationArgs. This feels more elegant to me since otherwise I'd be writing two derivations, one for writeShellApplication and then one toplevel mkDerivation...

name = "hytale-launcher";

runtimeInputs = [
coreutils
curl
flatpak
libnotify
];

text = ''
if ! flatpak info --user com.hypixel.HytaleLauncher >/dev/null 2>&1; then
notify-send "Hytale Launcher" "[Nix] Installing Hytale Launcher for the first time with Flatpak..." || true

logs="$(mktemp /tmp/nix-hytale-launcher-XXXXX.log || true)"

if ! (
tmp="$(mktemp /tmp/XXXXX.flatpak)" &&
curl -o "$tmp" https://launcher.hytale.com/builds/release/linux/amd64/hytale-launcher-latest.flatpak &&
flatpak install --user --noninteractive --bundle "$tmp"
) 2>&1 | tee "$logs"; then
notify-send "Hytale Launcher" "[Nix] Installing Hytale Launcher for failed! Logs in $logs"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
notify-send "Hytale Launcher" "[Nix] Installing Hytale Launcher for failed! Logs in $logs"
notify-send "Hytale Launcher" "[Nix] Installing Hytale Launcher failed! Logs in $logs"

Oops... I missed this on my first read through

exit 1
fi
fi

flatpak run --user \
${lib.concatMapStringsSep " " toFlatpakEnvArg (lib.attrsToList environment)} \
com.hypixel.HytaleLauncher
'';

derivationArgs = {
__structuredAttrs = true;
strictDeps = true;

nativeBuildInputs = [ copyDesktopItems ];
desktopItems = lib.singleton (makeDesktopItem {
name = "com.hypixel.HytaleLauncher";
desktopName = "Hytale Launcher";
genericName = "Launcher for sandbox block game";
exec = "hytale-launcher";
categories = [ "Game" ];
startupWMClass = "com.hypixel.HytaleLauncher";
});

# HACK: writeShellApplication doesn't run all phases by default, so we
# inject installPhase in checkPhase...
postCheck = "runPhase installPhase";

meta = {
description = "Official launcher for Hytale";
longDescription = ''
Official launcher for Hytale, an upcoming block-based game from Hypixel Studios.

NOTE: This package is a simply a script which downloads and installs
the Hytale launcher flatpak at *runtime*. From the first install, the
launcher version is managed entirely by the Hytale launcher itself,
meaning this package is **not reproducible**.

See discussions on [this pull request](https://github.com/NixOS/nixpkgs/pull/479368)
for more context on why this method was chosen.
'';
homepage = "https://hytale.com";
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [
gepbird
karol-broda
liquidnya
dtomvan
];
mainProgram = "hytale-launcher";
platforms = [ "x86_64-linux" ];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
};
};
}
Loading