So, I’m back again.
I’m trying to run an app that isn’t in the repo, it is distributed as an appimage.
I downloaded appimage-run, but when I try to use it I get a generic “segmentation fault” error:
I looked around, and the closest thing I could find was this bug report, but the first answer said appimage from the unstable repo was OK.
I tried downloading appimage-run from the unstable repo, but I get the same error.
I tried downloading the source code from their Github to try and create a package, but it turns out the app was made in Electron, and I have no knowledge of Electron at all. By what I understood reading other threads, making packages of Electron apps is a bit of a chore, and TBH my head hurt just from reading the example packages.
So, my best option would be trying the appimage. I imagine the problem I’m having to run it is exactly because it’s an Electron app. Is there any trick I must use to make an appimage work on NixOS (technically an appimage was made to be portable and run hassle-free in any distro, but NixOS is full of little surprises).
Hi. Thanks for the tip, I didn’t know about this tool.
By reading it, it seems simple enough to use, but I tried creating a simple .nix function to use it, and it’s not quite giving me the result I expected.
When running it in nix repl, I expected it to either fetch the appimage from github and then trying to wrap it, or for it to give me any other sort of error, but it just returns me a lambda function with fetchurl.
So I must be severely misunderstanding how nix functions work.
I’m going through the pills and the manual again to see if I can find where I did mess up.
Ah, thanks.
I guess my mistake was trying to run it the same way I saw in the Nix pills, I was supposed to build it. I also noticed I was supposed to call the fetchurl within the pkgs.
It really did build fine, but I can’t run it. Actually I can, it doesn’t give me any errors, but nothing happens.
I tried running it with -d to see where it stopped, and this is the output:
So, by what I understand, the script manages to extract the appimage and wrap it, but in the actual “running” nothing happens. And I believe this has something to do with Electron.
So, the “magic” to make this AppImage to work with NixOS didn’t really work. The source code is available, so I guess I’ll take a look at how to create a derivation of an Electron app again.
I checked the binaries in /nix/store/lkw1g55l2fsglznw6669433zp0x86ca3-LittleWeeb-extracted with ldd and some of them are missing linked libraries. Also, the AppRun script is expecting one of several dialong programs, such as zenity, so that’s another missing dependency. Not to mention there are various assertions being made by AppRun which can cause it to exit silently.
Despite all of that, I think you’re quite close to something usable. If you start with a derivation to build an Electron app you’ll probably find yourself no where near this close.
I encourage you to search Nixpkgs for uses of appimageTools, to get a sense of what you would need to do to get this appimage working.
Yeah, last night I tried to go the “wrapping an electron app” route, and really didn’t get any close to where I was with the appimage. It seems the app uses a different structure than the electron apps that were packaged before, and so I’d need to either patch the app or make many changes in the packaging script and, as I said, I’m not knowledgeable in Electron at all (TBH, I also barely know anything about Nix expressions). I think I’ll go back to trying with the appimageTools.
As I said yesterday, looking at the wiki the tools look very simple and without many options, but I bet there’s a lot of stuff underneath that I’m able to change and configure when doing the wrapping, so I guess it’s time to RTFM.
@emmanuelrosa I’m actually curious, do you have more information on why AppRun is quiet when failing? I’d love to see some errors, it’s very rare to see no error at all… And since electron app are quite common, wouldn’t it make sense to put required dependencies into appimage-run?
When I glanced at the AppRun script, I noticed various assertions (if-then blocks) which in exited without displaying any error. So if any of those assertions are triggered the app would just exit silently. I don’t know why it’s done that way.
I think the main problem stems from AppImage itself. Here’s a quote from their documentation where it describes how to put together an AppDir structure:
Of course you can leave out the library if your app does not need one, or if all libraries your app needs are already contained in every base operating system you are targeting.
This implies that an AppImage does not need to include all of it’s dependencies, and instead can rely on some undefined dependencies to be provided by the operating system. Contrary to what may be expected, there’s no way an AppImage can be expected to work on every Linux-based OS.
Perhaps a way to improve the NixOS appimage tooling is to determine which dependencies are commmonly not included in appimages because developers expect them to be provided by the operating system, and include those by default.
Thank you for the explanations. I’m also wondering if electron requires fuse in the sandbox scenario. It could explain also the failure since fuse does not work in bubblewrap.
I guess a first step is to display meaningful errors in appimage-run, add more common libraries, and check if electron sandboxed app can work out of the box or not.