From bbedfbd065aaf48ae1a709010682e50aba56cefa Mon Sep 17 00:00:00 2001 From: aucub <78630225+aucub@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:35:30 +0800 Subject: [PATCH 1/3] waveterm: fix hash mismatch --- pkgs/by-name/wa/waveterm/package.nix | 78 ++++++++++++++++++---------- pkgs/by-name/wa/waveterm/update.sh | 18 +++++-- 2 files changed, 64 insertions(+), 32 deletions(-) diff --git a/pkgs/by-name/wa/waveterm/package.nix b/pkgs/by-name/wa/waveterm/package.nix index b5a335068c3b..b5be2b35e6bc 100644 --- a/pkgs/by-name/wa/waveterm/package.nix +++ b/pkgs/by-name/wa/waveterm/package.nix @@ -29,35 +29,14 @@ udev, libGL, fetchzip, + unzip, }: let + inherit (stdenv.hostPlatform) system; + selectSystem = attrs: attrs.${system}; pname = "waveterm"; version = "0.9.2"; - - src = - let - inherit (stdenv.hostPlatform) system; - selectSystem = attrs: attrs.${system}; - suffix = selectSystem { - x86_64-linux = "waveterm-linux-x64"; - aarch64-linux = "waveterm-linux-arm64"; - x86_64-darwin = "Wave-darwin-x64"; - aarch64-darwin = "Wave-darwin-arm64"; - }; - hash = selectSystem { - x86_64-linux = "sha256-s6s/SfLNVwRN50OgqWTohHT8/rFuu4P3hpxfhA7kPOU="; - aarch64-linux = "sha256-dxQbTPvge3QY40rWKAOV/uuTPzHsfNk9USxICoF1CQM="; - x86_64-darwin = "sha256-/nedzsQxqLclK5uwOKZ/WgRwjoHDCxLuI+/T1B3cyJM="; - aarch64-darwin = "sha256-lBJEJHgBozrR+JF5jlbmuG2c0P19qmjJUhwlJtHqkRE="; - }; - in - fetchzip { - url = "https://github.com/wavetermdev/waveterm/releases/download/v${version}/${suffix}-${version}.zip"; - inherit hash; - stripRoot = false; - }; - passthru.updateScript = ./update.sh; desktopItems = [ @@ -104,12 +83,28 @@ let inherit pname version - src desktopItems meta passthru ; + src = + let + suffix = selectSystem { + x86_64-linux = "waveterm-linux-x64"; + aarch64-linux = "waveterm-linux-arm64"; + }; + hash = selectSystem { + x86_64-linux = "sha256-s6s/SfLNVwRN50OgqWTohHT8/rFuu4P3hpxfhA7kPOU="; + aarch64-linux = "sha256-dxQbTPvge3QY40rWKAOV/uuTPzHsfNk9USxICoF1CQM="; + }; + in + fetchzip { + url = "https://github.com/wavetermdev/waveterm/releases/download/v${version}/${suffix}-${version}.zip"; + inherit hash; + stripRoot = false; + }; + nativeBuildInputs = [ copyDesktopItems autoPatchelfHook @@ -162,22 +157,49 @@ let ''; }; - darwin = stdenv.mkDerivation { + darwin = stdenv.mkDerivation rec { inherit pname version - src meta passthru ; + src = + let + suffix = selectSystem { + x86_64-darwin = "Wave-darwin-x64"; + aarch64-darwin = "Wave-darwin-arm64"; + }; + hash = selectSystem { + x86_64-darwin = "sha256-5SJMLeAYk/m65hehsgDnlwS0JBLSgUP2Yx4iDtvtLS0="; + aarch64-darwin = "sha256-epadZvQKZtqBVUgkD76Aen752GSexYV2LQJOZ8+bcXk="; + }; + in + fetchurl { + url = "https://github.com/wavetermdev/waveterm/releases/download/v${version}/${suffix}-${version}.zip"; + inherit hash; + }; + + nativeBuildInputs = [ + unzip + ]; + + unpackPhase = '' + runHook preUnpack + + unzip ${src} -d ./ + + runHook postUnpack + ''; + sourceRoot = "Wave.app"; installPhase = '' runHook preInstall mkdir -p $out/Applications/Wave.app - cp -R . $out/Applications/Wave.app + cp -r . $out/Applications/Wave.app runHook postInstall ''; diff --git a/pkgs/by-name/wa/waveterm/update.sh b/pkgs/by-name/wa/waveterm/update.sh index 468477fa48f7..37eadc1edee6 100755 --- a/pkgs/by-name/wa/waveterm/update.sh +++ b/pkgs/by-name/wa/waveterm/update.sh @@ -1,7 +1,9 @@ #!/usr/bin/env nix-shell #!nix-shell -i bash -p bash nixVersions.latest curl coreutils jq common-updater-scripts -latestTag=$(curl -s ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} https://api.github.com/repos/wavetermdev/waveterm/releases/latest | jq -r ".tag_name") +set -eou pipefail + +latestTag=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sL https://api.github.com/repos/wavetermdev/waveterm/releases/latest | jq -r ".tag_name") latestVersion="$(expr "$latestTag" : 'v\(.*\)')" currentVersion=$(nix-instantiate --eval -E "with import ./. {}; waveterm.version" | tr -d '"') @@ -12,13 +14,21 @@ if [[ "$latestVersion" == "$currentVersion" ]]; then echo "package is up-to-date" exit 0 fi + for i in \ "x86_64-linux waveterm-linux-x64" \ - "aarch64-linux waveterm-linux-arm64" \ - "x86_64-darwin Wave-darwin-x64" \ - "aarch64-darwin Wave-darwin-arm64"; do + "aarch64-linux waveterm-linux-arm64"; do set -- $i prefetch=$(nix-prefetch-url --unpack "https://github.com/wavetermdev/waveterm/releases/download/v$latestVersion/$2-$latestVersion.zip") hash=$(nix hash convert --hash-algo sha256 --to sri $prefetch) update-source-version waveterm $latestVersion $hash --system=$1 --ignore-same-version done + +for i in \ + "x86_64-darwin Wave-darwin-x64" \ + "aarch64-darwin Wave-darwin-arm64"; do + set -- $i + prefetch=$(nix-prefetch-url "https://github.com/wavetermdev/waveterm/releases/download/v$latestVersion/$2-$latestVersion.zip") + hash=$(nix hash convert --hash-algo sha256 --to sri $prefetch) + update-source-version waveterm $latestVersion $hash --system=$1 --ignore-same-version +done From ae6bb83a839b8cc688e4a1effe2c84519afd3a20 Mon Sep 17 00:00:00 2001 From: aucub <78630225+aucub@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:36:27 +0800 Subject: [PATCH 2/3] pdfium-binaries: fix updateScript --- pkgs/by-name/pd/pdfium-binaries/update.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/pd/pdfium-binaries/update.sh b/pkgs/by-name/pd/pdfium-binaries/update.sh index c32ef7fab65d..1682c8f38ee5 100755 --- a/pkgs/by-name/pd/pdfium-binaries/update.sh +++ b/pkgs/by-name/pd/pdfium-binaries/update.sh @@ -1,7 +1,9 @@ #!/usr/bin/env nix-shell #!nix-shell -i bash -p bash nixVersions.latest curl coreutils jq common-updater-scripts -latestVersion=$(curl -s ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} https://api.github.com/repos/bblanchon/pdfium-binaries/releases/latest | jq -r '.tag_name | ltrimstr("chromium/")') +set -eou pipefail + +latestVersion=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sL https://api.github.com/repos/bblanchon/pdfium-binaries/releases/latest | jq -r '.tag_name | ltrimstr("chromium/")') currentVersion=$(nix-instantiate --eval -E "with import ./. {}; pdfium-binaries.version" | tr -d '"') echo "latest version: $latestVersion" @@ -11,6 +13,7 @@ if [[ "$latestVersion" == "$currentVersion" ]]; then echo "package is up-to-date" exit 0 fi + for i in \ "x86_64-linux linux-x64" \ "aarch64-linux linux-arm64" \ From 63f748d12ab50fd8fcef5e06e18450ef72ff64ee Mon Sep 17 00:00:00 2001 From: aucub <78630225+aucub@users.noreply.github.com> Date: Fri, 22 Nov 2024 00:29:25 +0000 Subject: [PATCH 3/3] waveterm: 0.9.2 -> 0.9.3 --- pkgs/by-name/wa/waveterm/package.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/wa/waveterm/package.nix b/pkgs/by-name/wa/waveterm/package.nix index b5be2b35e6bc..98844812d916 100644 --- a/pkgs/by-name/wa/waveterm/package.nix +++ b/pkgs/by-name/wa/waveterm/package.nix @@ -36,7 +36,7 @@ let inherit (stdenv.hostPlatform) system; selectSystem = attrs: attrs.${system}; pname = "waveterm"; - version = "0.9.2"; + version = "0.9.3"; passthru.updateScript = ./update.sh; desktopItems = [ @@ -95,8 +95,8 @@ let aarch64-linux = "waveterm-linux-arm64"; }; hash = selectSystem { - x86_64-linux = "sha256-s6s/SfLNVwRN50OgqWTohHT8/rFuu4P3hpxfhA7kPOU="; - aarch64-linux = "sha256-dxQbTPvge3QY40rWKAOV/uuTPzHsfNk9USxICoF1CQM="; + x86_64-linux = "sha256-zmmWQnZklnmhVrZp0F0dkVHVMW+K/VynSvbF9Zer/RE="; + aarch64-linux = "sha256-HRZRRUV6CVqUQYuvXBmnNcAsbZwgNDZiEf+gjdLDaPQ="; }; in fetchzip { @@ -172,8 +172,8 @@ let aarch64-darwin = "Wave-darwin-arm64"; }; hash = selectSystem { - x86_64-darwin = "sha256-5SJMLeAYk/m65hehsgDnlwS0JBLSgUP2Yx4iDtvtLS0="; - aarch64-darwin = "sha256-epadZvQKZtqBVUgkD76Aen752GSexYV2LQJOZ8+bcXk="; + x86_64-darwin = "sha256-NSpNWUWdRkB2H5l/WnI/Xyv68h0OXX7SIKyDAq0LIJM="; + aarch64-darwin = "sha256-QkJMrmqrveFc2StL5gVpE78DlC1OBcEV+tY7p2nJ/6I="; }; in fetchurl {