-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
hytale-launcher: init #514526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
hytale-launcher: init #514526
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 { | ||||||
| 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" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
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 ]; | ||||||
| }; | ||||||
| }; | ||||||
| } | ||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
writeShellApplicationat 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 tomkDerivationif possible, but it installs fine on my system just fine as is.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Under the hood
writeShellApplicationis justmkDerivationwith a custombuildPhase... hence I can overridederivationArgs. This feels more elegant to me since otherwise I'd be writing two derivations, one forwriteShellApplicationand then one toplevelmkDerivation...