From 244b31e61b38b2cd86de15af6c9aa005b6fef942 Mon Sep 17 00:00:00 2001 From: FliegendeWurst Date: Sun, 27 Apr 2025 18:55:42 +0200 Subject: [PATCH 1/2] doc/build-helpers: fix appimage example where postExtract is used --- .../images/appimagetools.section.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/build-helpers/images/appimagetools.section.md b/doc/build-helpers/images/appimagetools.section.md index 7bfc45287d1f..7da9f4ab9984 100644 --- a/doc/build-helpers/images/appimagetools.section.md +++ b/doc/build-helpers/images/appimagetools.section.md @@ -129,11 +129,16 @@ appimageTools.wrapType2 { The argument passed to `extract` can also contain a `postExtract` attribute, which allows you to execute additional commands after the files are extracted from the AppImage. `postExtract` must be a string with commands to run. +:::{.warning} +When specifying `postExtract`, you should use `appimageTools.wrapAppImage` instead of `appimageTools.wrapType2`. +Otherwise `wrapType2` will extract the AppImage contents without respecting the `postExtract` instructions. +::: + :::{.example #ex-extracting-appimage-with-postextract} # Extracting an AppImage to install extra files, using `postExtract` -This is a rewrite of [](#ex-extracting-appimage) to use `postExtract`. +This is a rewrite of [](#ex-extracting-appimage) to use `postExtract` and `wrapAppImage`. ```nix { appimageTools, fetchurl }: @@ -153,8 +158,10 @@ let ''; }; in -appimageTools.wrapType2 { - inherit pname version src; +appimageTools.wrapAppImage { + inherit pname version; + + src = appimageContents; extraPkgs = pkgs: [ pkgs.at-spi2-core ]; @@ -164,6 +171,9 @@ appimageTools.wrapType2 { install -m 444 -D ${appimageContents}/usr/share/icons/hicolor/512x512/apps/irccloud.png \ $out/share/icons/hicolor/512x512/apps/irccloud.png ''; + + # specify src archive for nix-update + passthru.src = src; } ``` From 855da9ad3547b2052d31eac96946bbb984028480 Mon Sep 17 00:00:00 2001 From: FliegendeWurst Date: Sun, 27 Apr 2025 18:55:42 +0200 Subject: [PATCH 2/2] doc/build-helpers: don't overuse pname See #277994 --- doc/build-helpers/images/appimagetools.section.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/build-helpers/images/appimagetools.section.md b/doc/build-helpers/images/appimagetools.section.md index 7da9f4ab9984..a3654b27de5f 100644 --- a/doc/build-helpers/images/appimagetools.section.md +++ b/doc/build-helpers/images/appimagetools.section.md @@ -114,12 +114,12 @@ appimageTools.wrapType2 { extraPkgs = pkgs: [ pkgs.at-spi2-core ]; extraInstallCommands = '' - mv $out/bin/${pname}-${version} $out/bin/${pname} + mv $out/bin/irccloud-${version} $out/bin/irccloud install -m 444 -D ${appimageContents}/irccloud.desktop $out/share/applications/irccloud.desktop install -m 444 -D ${appimageContents}/usr/share/icons/hicolor/512x512/apps/irccloud.png \ $out/share/icons/hicolor/512x512/apps/irccloud.png substituteInPlace $out/share/applications/irccloud.desktop \ - --replace-fail 'Exec=AppRun' 'Exec=${pname}' + --replace-fail 'Exec=AppRun' 'Exec=irccloud' ''; } ``` @@ -154,7 +154,7 @@ let appimageContents = appimageTools.extract { inherit pname version src; postExtract = '' - substituteInPlace $out/irccloud.desktop --replace-fail 'Exec=AppRun' 'Exec=${pname}' + substituteInPlace $out/irccloud.desktop --replace-fail 'Exec=AppRun' 'Exec=irccloud' ''; }; in @@ -166,7 +166,7 @@ appimageTools.wrapAppImage { extraPkgs = pkgs: [ pkgs.at-spi2-core ]; extraInstallCommands = '' - mv $out/bin/${pname}-${version} $out/bin/${pname} + mv $out/bin/irccloud-${version} $out/bin/irccloud install -m 444 -D ${appimageContents}/irccloud.desktop $out/share/applications/irccloud.desktop install -m 444 -D ${appimageContents}/usr/share/icons/hicolor/512x512/apps/irccloud.png \ $out/share/icons/hicolor/512x512/apps/irccloud.png