Unable to wrap appimage

Hello there!

I’ve been trying for past hours to wrap an image for a new package, but without success. I’ve already packaged a few appimage with success with more or less the same methods, but here I can’t get it work or extract some useful logs. The appimage itself it a type 2 of what I understand and its content is standard for what I see.
I’ve extracted its content to inspect it. Nothing weird. I also ran the app successfully on the same machine where I’m building it x86_64-linux on NixOS.

Can someone help figure out the problem or at least, get some useful logs, please?

Thanks in advance!

Here are the logs: git-butler.nix · GitHub

Code: git-butler.nix · GitHub

If you take a look at the failing derivation using nix derivation show '/nix/store/r11fmrv1mkk2k9sdbbdq2wzjibyal356-git-butler-0.11.5-extracted.drv', you will see its buildCommand is this:

      "buildCommand": "appimage-exec.sh -x $out /nix/store/13ail647r7b1aanzgxd28pyrq2vvra4r-source\n\n",

It’s trying to unpack /nix/store/13ail647r7b1aanzgxd28pyrq2vvra4r-source but that’s a directory containing git-butler_0.11.5_amd64.AppImage. It needs to be pointed at the appimage itself (/nix/store/13ail647r7b1aanzgxd28pyrq2vvra4r-source/git-butler_0.11.5_amd64.AppImage).

The reason for this is that upstream packed the appimage into a directory inside a tarball for godknows what reason.

The best fix is to make the output of the src a single file: The AppImage itself.

2 Likes

Something like

@@ -23,6 +23,11 @@
     x86_64-linux = fetchzip {
       url = "https://releases.gitbutler.com/releases/release/${version}-${build_version}/linux/x86_64/git-butler_${version}_amd64.AppImage.tar.gz";
       hash = "sha256-T/Hh4+USuhPQpY/KjYSDfBF7fkM860iW5Y/gmq37qn0=";
+      postFetch = ''
+        mv $out/* $TMPDIR/tmp
+        rm -r $out
+        mv $TMPDIR/tmp $out
+      '';
     };
   }.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
 

should work.

1 Like

@Atemu Thank you so much for the explanation! I didn’t know about the nix derivation command. Really helpful.
Now that I see this, it is indeed the problem here and I know where to go.

Thank you very much for the detailed answer. You taught me a lot with only this ^^.

1 Like