Merge pull request #231747 from felschr/update-scripts

add updateScript to various packages

authored by

Sandro and committed by
GitHub
59bc44dc 793dd345

+103 -8
+3 -1
pkgs/applications/editors/ldtk/default.nix
··· 1 1 { lib, stdenv, fetchurl, makeWrapper, makeDesktopItem, copyDesktopItems, unzip 2 - , appimage-run }: 2 + , appimage-run, nix-update-script }: 3 3 4 4 stdenv.mkDerivation rec { 5 5 pname = "ldtk"; ··· 46 46 mimeTypes = [ "application/json" ]; 47 47 }) 48 48 ]; 49 + 50 + passthru.updateScript = nix-update-script { }; 49 51 50 52 meta = with lib; { 51 53 description = "Modern, lightweight and efficient 2D level editor";
+3 -1
pkgs/applications/editors/pixelorama/default.nix
··· 1 - { lib, stdenv, fetchFromGitHub, godot-headless, godot-export-templates }: 1 + { lib, stdenv, fetchFromGitHub, godot-headless, godot-export-templates, nix-update-script }: 2 2 3 3 let 4 4 preset = ··· 46 46 47 47 runHook postInstall 48 48 ''; 49 + 50 + passthru.updateScript = nix-update-script { }; 49 51 50 52 meta = with lib; { 51 53 homepage = "https://orama-interactive.itch.io/pixelorama";
+13 -3
pkgs/applications/networking/browsers/mullvad-browser/default.nix
··· 6 6 , makeWrapper 7 7 , writeText 8 8 , wrapGAppsHook 9 + , callPackage 9 10 10 11 # Common run-time dependencies 11 12 , zlib ··· 79 80 80 81 version = "12.0.6"; 81 82 82 - srcs = { 83 + sources = { 83 84 x86_64-linux = fetchurl { 84 85 url = "https://cdn.mullvad.net/browser/${version}/mullvad-browser-linux64-${version}_ALL.tar.xz"; 85 86 hash = "sha256-XE6HFU38FhnikxGHRHxIGS3Z3Y2JNWH0yq2NejqbROI="; ··· 103 104 pname = "mullvad-browser"; 104 105 inherit version; 105 106 106 - src = srcs.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}"); 107 + src = sources.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}"); 107 108 108 109 nativeBuildInputs = [ copyDesktopItems makeWrapper wrapGAppsHook ]; 109 110 ··· 219 220 runHook postInstall 220 221 ''; 221 222 223 + passthru = { 224 + inherit sources; 225 + updateScript = callPackage ../tor-browser-bundle-bin/update.nix { 226 + inherit pname version meta; 227 + baseUrl = "https://cdn.mullvad.net/browser/"; 228 + prefix = "mullvad-browser-"; 229 + }; 230 + }; 231 + 222 232 meta = with lib; { 223 233 description = "Privacy-focused browser made in a collaboration between The Tor Project and Mullvad"; 224 234 homepage = "https://mullvad.net/en/browser"; 225 - platforms = attrNames srcs; 235 + platforms = attrNames sources; 226 236 maintainers = with maintainers; [ felschr ]; 227 237 # MPL2.0+, GPL+, &c. While it's not entirely clear whether 228 238 # the compound is "libre" in a strict sense (some components place certain
+11 -3
pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix
··· 2 2 , fetchurl 3 3 , makeDesktopItem 4 4 , writeText 5 + , callPackage 5 6 6 7 # Common run-time dependencies 7 8 , zlib ··· 92 93 93 94 lang = "ALL"; 94 95 95 - srcs = { 96 + sources = { 96 97 x86_64-linux = fetchurl { 97 98 urls = [ 98 99 "https://dist.torproject.org/torbrowser/${version}/tor-browser-linux64-${version}_${lang}.tar.xz" ··· 131 132 pname = "tor-browser-bundle-bin"; 132 133 inherit version; 133 134 134 - src = srcs.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}"); 135 + src = sources.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}"); 135 136 136 137 preferLocalBuild = true; 137 138 allowSubstitutes = false; ··· 447 448 runHook postInstall 448 449 ''; 449 450 451 + passthru = { 452 + inherit sources; 453 + updateScript = callPackage ./update.nix { 454 + inherit pname version meta; 455 + }; 456 + }; 457 + 450 458 meta = with lib; { 451 459 description = "Tor Browser Bundle built by torproject.org"; 452 460 longDescription = '' ··· 460 468 ''; 461 469 homepage = "https://www.torproject.org/"; 462 470 changelog = "https://gitweb.torproject.org/builders/tor-browser-build.git/plain/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt?h=maint-${version}"; 463 - platforms = attrNames srcs; 471 + platforms = attrNames sources; 464 472 maintainers = with maintainers; [ offline matejc thoughtpolice joachifm hax404 KarlJoad ]; 465 473 mainProgram = "tor-browser"; 466 474 # MPL2.0+, GPL+, &c. While it's not entirely clear whether
+62
pkgs/applications/networking/browsers/tor-browser-bundle-bin/update.nix
··· 1 + { lib 2 + , writeShellScript 3 + , coreutils 4 + , gnused 5 + , gnugrep 6 + , curl 7 + , gnupg 8 + , nix 9 + , common-updater-scripts 10 + 11 + # options 12 + , pname 13 + , version 14 + , meta 15 + , baseUrl ? "https://dist.torproject.org/torbrowser/" 16 + # prefix used to match published archive 17 + , prefix ? "tor-browser-" 18 + # suffix used to match published archive 19 + , suffix ? "_ALL.tar.xz" 20 + }: 21 + 22 + writeShellScript "update-${pname}" '' 23 + PATH="${lib.makeBinPath [ coreutils curl gnugrep gnused gnupg nix common-updater-scripts ]}" 24 + set -euo pipefail 25 + 26 + trap 27 + 28 + url=${baseUrl} 29 + version=$(curl -s $url \ 30 + | sed -rne 's,^.*href="([0-9]+(\.[0-9]+)*)/".*,\1,p' \ 31 + | sort --version-sort | tail -1) 32 + 33 + if [[ "${version}" = "$version" ]]; then 34 + echo "The new version same as the old version." 35 + exit 0 36 + fi 37 + 38 + HOME=$(mktemp -d) 39 + export GNUPGHOME=$(mktemp -d) 40 + trap 'rm -rf "$HOME" "$GNUPGHOME"' EXIT 41 + 42 + gpg --auto-key-locate nodefault,wkd --locate-keys torbrowser@torproject.org 43 + gpg --output $HOME/tor.keyring --export 0xEF6E286DDA85EA2A4BA7DE684E2C6E8793298290 44 + 45 + curl --silent --show-error --fail -o $HOME/shasums "$url$version/sha256sums-signed-build.txt" 46 + curl --silent --show-error --fail -o $HOME/shasums.asc "$url$version/sha256sums-signed-build.txt.asc" 47 + gpgv --keyring=$HOME/tor.keyring $HOME/shasums.asc $HOME/shasums 48 + 49 + declare -A platforms=( 50 + ['x86_64-linux']='linux64' 51 + ['i686-linux']='linux32' 52 + ) 53 + 54 + for platform in ${lib.escapeShellArgs meta.platforms}; do 55 + arch="''${platforms[$platform]}" 56 + sha256=$(cat "$HOME/shasums" | grep "${prefix}""$arch-$version""${suffix}" | cut -d" " -f1) 57 + hash=$(nix hash to-sri --type sha256 "$sha256") 58 + 59 + update-source-version "${pname}" "0" "sha256-${lib.fakeSha256}" --source-key="sources.$platform" 60 + update-source-version "${pname}" "$version" "$hash" --source-key="sources.$platform" 61 + done 62 + ''
+8
pkgs/applications/video/filebot/default.nix
··· 1 1 { lib, stdenv, fetchurl, coreutils, openjdk17, makeWrapper, autoPatchelfHook 2 2 , zlib, libzen, libmediainfo, curlWithGnuTls, libmms, glib 3 + , genericUpdater, writeShellScript 3 4 }: 4 5 5 6 let ··· 42 43 # Expose the binary in bin to make runnable. 43 44 ln -s $out/opt/filebot.sh $out/bin/filebot 44 45 ''; 46 + 47 + passthru.updateScript = genericUpdater { 48 + versionLister = writeShellScript "filebot-versionLister" '' 49 + curl -s https://www.filebot.net \ 50 + | sed -rne 's,^.*FileBot_([0-9]*\.[0-9]+\.[0-9]+)-portable.tar.xz.*,\1,p' 51 + ''; 52 + }; 45 53 46 54 meta = with lib; { 47 55 description = "The ultimate TV and Movie Renamer";
+3
pkgs/servers/etebase/default.nix
··· 12 12 , python-ldap 13 13 , withPostgres ? true 14 14 , psycopg2 15 + , nix-update-script 15 16 }: 16 17 17 18 buildPythonPackage rec { ··· 46 47 wrapProgram $out/bin/etebase-server --prefix PYTHONPATH : "$PYTHONPATH" 47 48 chmod +x $out/bin/etebase-server 48 49 ''; 50 + 51 + passthru.updateScript = nix-update-script {}; 49 52 50 53 meta = with lib; { 51 54 homepage = "https://github.com/etesync/server";