Skip to content
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

lunar-client: migrate to by-name and add updateScript #263015

Merged
merged 2 commits into from
Nov 6, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let

src = fetchurl {
url = "https://launcherupdates.lunarclientcdn.com/Lunar%20Client-${version}.AppImage";
hash = "sha256-6OAGNkMyHOZI5wh92OtalnvUVFWNAS9PvkFS0e4YXhk=";
hash = "sha512-YUddAvsPbuuOvhJZsWDvgF/7yghABU6Av7DcKNX1bKZqE3BzMAAQADJuNuNL4+UydoTaHetXvRO8oJCbrqgtAQ==";
};

appimageContents = appimageTools.extract { inherit pname version src; };
Expand All @@ -30,6 +30,8 @@ appimageTools.wrapType2 rec {
--replace 'Icon=launcher' 'Icon=lunar-client'
'';

passthru.updateScript = ./update.sh;

meta = with lib; {
description = "Free Minecraft client with mods, cosmetics, and performance boost.";
homepage = "https://www.lunarclient.com/";
Expand Down
12 changes: 12 additions & 0 deletions pkgs/by-name/lu/lunar-client/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl yq
set -eu -o pipefail

target="$(dirname "$(readlink -f "$0")")/package.nix"
host="https://launcherupdates.lunarclientcdn.com"
metadata=$(curl "$host/latest-linux.yml")
version=$(echo "$metadata" | yq .version -r)
sha512=$(echo "$metadata" | yq .sha512 -r)

sed -i "s@version = .*;@version = \"$version\";@g" "$target"
sed -i "s@hash.* = .*;@hash = \"sha512-$sha512\";@g" "$target"
pbsds marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 0 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37466,8 +37466,6 @@ with pkgs;

ltris = callPackage ../games/lgames/ltris { };

lunar-client = callPackage ../games/lunar-client { };

maelstrom = callPackage ../games/maelstrom { };

mar1d = callPackage ../games/mar1d { } ;
Expand Down