From 6fa1cabb73c751528783bf511d4c474c047bb69a Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sun, 2 Mar 2025 23:51:16 +0000 Subject: [PATCH] =?UTF-8?q?loupe:=2047.4=20=E2=86=92=2048.rc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://gitlab.gnome.org/GNOME/loupe/-/compare/47.4...48.rc - cargo dependencies no longer vendored in the dist tarball https://gitlab.gnome.org/GNOME/loupe/-/commit/b54e85a5a64596c004afdf71610f1c5595303a86 Changelog-Reviewed-By: Jan Tojnar --- pkgs/by-name/lo/loupe/package.nix | 64 ++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 19 deletions(-) diff --git a/pkgs/by-name/lo/loupe/package.nix b/pkgs/by-name/lo/loupe/package.nix index 373eb637020e..772acc467410 100644 --- a/pkgs/by-name/lo/loupe/package.nix +++ b/pkgs/by-name/lo/loupe/package.nix @@ -8,8 +8,6 @@ meson, ninja, pkg-config, - jq, - moreutils, rustc, wrapGAppsHook4, gtk4, @@ -19,21 +17,25 @@ libseccomp, glycin-loaders, gnome, + common-updater-scripts, + _experimental-update-script-combinators, + rustPlatform, }: stdenv.mkDerivation (finalAttrs: { pname = "loupe"; - version = "47.4"; + version = "48.rc"; src = fetchurl { url = "mirror://gnome/sources/loupe/${lib.versions.major finalAttrs.version}/loupe-${finalAttrs.version}.tar.xz"; - hash = "sha256-jckmgpqcM4gAyPQytaNHJG5ty9mtLdGiTEmOr90+ias="; + hash = "sha256-vNRw832vFsejBCrSJ+m1DtNp8j69sMgYJQS6AbCxfEA="; }; - patches = [ - # Fix paths in glycin library - glycin-loaders.passthru.glycinPathsPatch - ]; + cargoDeps = rustPlatform.fetchCargoVendor { + inherit (finalAttrs) src; + name = "loupe-deps-${finalAttrs.version}"; + hash = "sha256-aR20tWdrjz2aI86amHj1aRjOEf5hVfIq1xS6QP/vOIs="; + }; nativeBuildInputs = [ cargo @@ -42,9 +44,8 @@ stdenv.mkDerivation (finalAttrs: { meson ninja pkg-config - jq - moreutils rustc + rustPlatform.cargoSetupHook wrapGAppsHook4 ]; @@ -56,13 +57,12 @@ stdenv.mkDerivation (finalAttrs: { libseccomp ]; - postPatch = '' - # Replace hash of file we patch in vendored glycin. - jq \ - --arg hash "$(sha256sum vendor/glycin/src/sandbox.rs | cut -d' ' -f 1)" \ - '.files."src/sandbox.rs" = $hash' \ - vendor/glycin/.cargo-checksum.json \ - | sponge vendor/glycin/.cargo-checksum.json + preConfigure = '' + # Dirty approach to add patches after cargoSetupPostUnpackHook + # We should eventually use a cargo vendor patch hook instead + pushd ../$(stripHash $cargoDeps)/glycin-2.* + patch -p3 < ${glycin-loaders.passthru.glycinPathsPatch} + popd ''; preFixup = '' @@ -73,8 +73,34 @@ stdenv.mkDerivation (finalAttrs: { ) ''; - passthru.updateScript = gnome.updateScript { - packageName = "loupe"; + passthru = { + updateScript = + let + updateSource = gnome.updateScript { + packageName = "loupe"; + }; + + updateLockfile = { + command = [ + "sh" + "-c" + '' + PATH=${ + lib.makeBinPath [ + common-updater-scripts + ] + } + update-source-version loupe --ignore-same-version --source-key=cargoDeps.vendorStaging > /dev/null + '' + ]; + # Experimental feature: do not copy! + supportedFeatures = [ "silent" ]; + }; + in + _experimental-update-script-combinators.sequence [ + updateSource + updateLockfile + ]; }; meta = with lib; {