From 03b2c6cec8709ca45fdbf248b7890a4a4c7380c3 Mon Sep 17 00:00:00 2001 From: nat Date: Mon, 23 Oct 2023 19:01:39 +0200 Subject: [PATCH 1/2] lunar-client: migrate to by-name --- .../default.nix => by-name/lu/lunar-client/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{games/lunar-client/default.nix => by-name/lu/lunar-client/package.nix} (100%) diff --git a/pkgs/games/lunar-client/default.nix b/pkgs/by-name/lu/lunar-client/package.nix similarity index 100% rename from pkgs/games/lunar-client/default.nix rename to pkgs/by-name/lu/lunar-client/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5a23e5416f952..5b07623e59372 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { } ; From 539466804b46ba5b2c861f39c2a04f19ac435c2a Mon Sep 17 00:00:00 2001 From: nat Date: Mon, 23 Oct 2023 22:01:41 +0200 Subject: [PATCH 2/2] lunar-client: add updateScript --- pkgs/by-name/lu/lunar-client/package.nix | 4 +++- pkgs/by-name/lu/lunar-client/update.sh | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 pkgs/by-name/lu/lunar-client/update.sh diff --git a/pkgs/by-name/lu/lunar-client/package.nix b/pkgs/by-name/lu/lunar-client/package.nix index 042259fcfae22..1506e5c0cb645 100644 --- a/pkgs/by-name/lu/lunar-client/package.nix +++ b/pkgs/by-name/lu/lunar-client/package.nix @@ -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; }; @@ -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/"; diff --git a/pkgs/by-name/lu/lunar-client/update.sh b/pkgs/by-name/lu/lunar-client/update.sh new file mode 100755 index 0000000000000..aa0adbff2b294 --- /dev/null +++ b/pkgs/by-name/lu/lunar-client/update.sh @@ -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"