3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #278137 from surfaceflinger/update-lunar

This commit is contained in:
Sandro 2024-01-24 14:36:53 +01:00 committed by GitHub
commit 4e1402cbe8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 21 deletions

View file

@ -4,31 +4,28 @@
, makeWrapper
}:
let
appimageTools.wrapType2 rec {
pname = "lunar-client";
version = "3.1.3";
version = "3.2.1";
src = fetchurl {
url = "https://launcherupdates.lunarclientcdn.com/Lunar%20Client-${version}.AppImage";
hash = "sha512-VV6UH0mEv+bABljDKZUOZXBjM1Whf2uacUQI8AnyLDBYI7pH0fkdjsBfjhQhFL0p8nHOwPAQflA+8vRFLH/uZw==";
hash = "sha512-ZW+SFIZ5+xxgesaZ7ZQbUnv7H5U92SZdfAU7GhJR1H0mhkrIb5Go6GWrIXaWYZLrmOlD98LSLihYi7SemJp+Yg==";
};
appimageContents = appimageTools.extract { inherit pname version src; };
in
appimageTools.wrapType2 rec {
inherit pname version src;
extraInstallCommands = ''
mv $out/bin/{${pname}-${version},${pname}}
source "${makeWrapper}/nix-support/setup-hook"
wrapProgram $out/bin/${pname} \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
install -Dm444 ${appimageContents}/launcher.desktop $out/share/applications/lunar-client.desktop
install -Dm444 ${appimageContents}/launcher.png $out/share/pixmaps/lunar-client.png
substituteInPlace $out/share/applications/lunar-client.desktop \
--replace 'Exec=AppRun --no-sandbox %U' 'Exec=lunar-client' \
--replace 'Icon=launcher' 'Icon=lunar-client'
'';
extraInstallCommands =
let contents = appimageTools.extract { inherit pname version src; };
in ''
mv $out/bin/{lunar-client-*,lunar-client}
source "${makeWrapper}/nix-support/setup-hook"
wrapProgram $out/bin/lunar-client \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
install -Dm444 ${contents}/launcher.desktop $out/share/applications/lunar-client.desktop
install -Dm444 ${contents}/launcher.png $out/share/pixmaps/lunar-client.png
substituteInPlace $out/share/applications/lunar-client.desktop \
--replace 'Exec=AppRun --no-sandbox %U' 'Exec=lunar-client' \
--replace 'Icon=launcher' 'Icon=lunar-client'
'';
passthru.updateScript = ./update.sh;

View file

@ -6,7 +6,7 @@ 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)
hash=$(echo "$metadata" | yq .sha512 -r)
sed -i "s@version = .*;@version = \"$version\";@g" "$target"
sed -i "s@hash.* = .*;@hash = \"sha512-$sha512\";@g" "$target"
sed -i "s@hash.* = .*;@hash = \"sha512-$hash\";@g" "$target"