diff options
author | Fabian Möller <fabianm88@gmail.com> | 2024-03-15 14:00:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-15 14:00:34 +0100 |
commit | 54daef752edf101416376873a849789620170dfb (patch) | |
tree | 84880aec35e59e6120e3d9d22e0a8a4050b6c96d /pkgs/applications/networking/breitbandmessung | |
parent | 65aa02f0ce2a1fa2245f8ddada8e749b1a670251 (diff) |
breitbandmessung: 3.3.0 -> 3.6.0 (#295875)
Things changed:
- Unpin electron version. Upstream updates usually fix electron incompatibilities and we also have a test which can detect them. (#295770)
- Add updater script. It scrapes the upstream website for the current version number. Lets hope the website structure doesn't change too much.
- Update to the latest version
Diffstat (limited to 'pkgs/applications/networking/breitbandmessung')
3 files changed, 48 insertions, 13 deletions
diff --git a/pkgs/applications/networking/breitbandmessung/default.nix b/pkgs/applications/networking/breitbandmessung/default.nix index 09ec430e6548..9a6cc8a4f739 100644 --- a/pkgs/applications/networking/breitbandmessung/default.nix +++ b/pkgs/applications/networking/breitbandmessung/default.nix @@ -3,7 +3,7 @@ , fetchurl , asar , dpkg -, electron_24 +, electron , makeWrapper , nixosTests , undmg @@ -12,14 +12,11 @@ let inherit (stdenv.hostPlatform) system; - version = "3.3.0"; + sources = import ./sources.nix; systemArgs = rec { - x86_64-linux = rec { - src = fetchurl { - url = "https://download.breitbandmessung.de/bbm/Breitbandmessung-${version}-linux.deb"; - sha256 = "sha256-12mbdxklje9msnRtNk1RAtIg3OCybev/vUersDZj2i4="; - }; + x86_64-linux = { + src = fetchurl sources.x86_64-linux; nativeBuildInputs = [ asar @@ -49,7 +46,7 @@ let } EOF - makeWrapper ${electron_24}/bin/electron $out/bin/breitbandmessung \ + makeWrapper ${electron}/bin/electron $out/bin/breitbandmessung \ --add-flags $out/share/breitbandmessung/resources/build/electron.js # Fix the desktop link @@ -59,10 +56,7 @@ let }; x86_64-darwin = { - src = fetchurl { - url = "https://download.breitbandmessung.de/bbm/Breitbandmessung-${version}-mac.dmg"; - sha256 = "sha256-a27R/N13i4qU2znTKz+LGxSdgSzJ0MzIHeiPHyRd65k="; - }; + src = fetchurl sources.x86_64-darwin; nativeBuildInputs = [ undmg ]; @@ -79,9 +73,10 @@ let in stdenv.mkDerivation ({ pname = "breitbandmessung"; - inherit version; + inherit (sources) version; passthru.tests = { inherit (nixosTests) breitbandmessung; }; + passthru.updateScript = ./update.sh; meta = with lib; { description = "Broadband internet speed test app from the german Bundesnetzagentur"; diff --git a/pkgs/applications/networking/breitbandmessung/sources.nix b/pkgs/applications/networking/breitbandmessung/sources.nix new file mode 100644 index 000000000000..d97cc1179952 --- /dev/null +++ b/pkgs/applications/networking/breitbandmessung/sources.nix @@ -0,0 +1,11 @@ +{ + version = "3.6.0"; + x86_64-linux = { + url = "https://download.breitbandmessung.de/bbm/Breitbandmessung-3.6.0-linux.deb"; + sha256 = "sha256-jUp4Q9tiR/WLkTNHz97j0eE/WwcfFF3ut0S9N4M75Oc="; + }; + x86_64-darwin = { + url = "https://download.breitbandmessung.de/bbm/Breitbandmessung-3.6.0-mac.dmg"; + sha256 = "sha256-ZvTig1/fm1GRoOYuTRBiZ8j4CRbZSa95q6a0sxo39Gs="; + }; +} diff --git a/pkgs/applications/networking/breitbandmessung/update.sh b/pkgs/applications/networking/breitbandmessung/update.sh new file mode 100755 index 000000000000..da982adf933b --- /dev/null +++ b/pkgs/applications/networking/breitbandmessung/update.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl jq nix ripgrep + +set -xeu -o pipefail + +PACKAGE_DIR="$(realpath "$(dirname "$0")")" + +current="$(nix eval -f "$PACKAGE_DIR/sources.nix" --raw version || :)" +latest="$(curl -sS https://breitbandmessung.de/desktop-app | \ + rg '.*Aktuelle Version der Desktop-App lautet:\s*([.0-9]+).*' -r '$1')" + +if [[ $current != $latest ]]; then + linux_hash="$(nix store prefetch-file --json https://download.breitbandmessung.de/bbm/Breitbandmessung-${latest}-linux.deb | jq -r .hash)" + darwin_hash="$(nix store prefetch-file --json https://download.breitbandmessung.de/bbm/Breitbandmessung-${latest}-mac.dmg | jq -r .hash)" + + cat <<EOF >"$PACKAGE_DIR/sources.nix" +{ + version = "${latest}"; + x86_64-linux = { + url = "https://download.breitbandmessung.de/bbm/Breitbandmessung-${latest}-linux.deb"; + sha256 = "${linux_hash}"; + }; + x86_64-darwin = { + url = "https://download.breitbandmessung.de/bbm/Breitbandmessung-${latest}-mac.dmg"; + sha256 = "${darwin_hash}"; + }; +} +EOF +fi |