Add package to AppImage-run without write a new derivation

I want to run Netron. It’s distributed as AppImage. So I tried to use appimage-run to run it:

❯ appimage-run Netron-4.8.1.AppImage                                                                                            
Netron-4.8.1.AppImage installed in /home/thiago/.cache/appimage-run/57c7da4d85636014e68318f0f00c401350a2c50d4cedbb9f4a03b3605206b17f
/home/thiago/.cache/appimage-run/57c7da4d85636014e68318f0f00c401350a2c50d4cedbb9f4a03b3605206b17f/netron: error while loading shared libraries: libxshmfence.so.1: cannot open shared object file: No such file or directory

It seems to that xorg.libxshmfence is not included in appimage-run environment. Is it possible to add xorg.libxshmfence or other package inside of appimage-run environment without write a new derivation?

The short answer is: No it is no possible without making a new derivation

The longer answer is that since making new derivations that slightly alter or fix existing derivations is so common derivations usually have extension points that make doing this slightly less painful.

As an example if you are using NixOS you can add your missing library to the system installed appimage-run with this snippet:

  environment.systemPackages = with pkgs; [
    (appimage-run.override {
      extraPkgs = pkgs: [ pkgs.xorg.libxshmfence ];
    })
  ];
2 Likes

It would be cool if NixOS had some thing like nix-shell but to FHS envs, something like:

nix-fsh-shell -p default_fhs python3 latex xorg.libxshmfence

So a new FHS would be created with the default packages (like appimageTools.defaultFhsEnvArgs.multiPkgs), python3, latex and xorg.libxshmfence

This is the only answer I have come across on the entire internet, so forgive me for reviving this thread, as I have no other leads.

I used that code snippet in my configuration, yet it did not help, at all. The AppImage still won’t find that library. Rebuilding and upgrading all configuration several times, did not help.

Is there any documentation on this? All I find are posts saying “just use appimage-run”, like yeah, no kidding. I am already using it. The library is still not found, though.

There are probably tons of libraries being contacted by AppImages, causing such issues, so I assume I am by far not the only one with this issue.

This issue did not help much, either. It’s also marked as solved, which it obviously isn’t.

Sorry to bring this old thread up again but did you figure out a solution to this? I’m having the exact same problem and can’t seem to find a fix for it. I’m quite new to NixOS so I might be missing something.

I’m trying to run this software: Release 0.2.0 · joaomgcd/Tasker-Permissions · GitHub

I was having the same problem trying to launch ganache from Ganache - Truffle Suite

but the solution from @griff fixed it from me. This seems like a widespread enough package that it should be available by default in appimage-run in NixOS no?

There was this merge request a long time ago that would fix this, but seems like it never got applied: appimage-run: add missing dependency libxshmfence by trepetti · Pull Request #118846 · NixOS/nixpkgs · GitHub

The fix should be simple so I created an issue requesting the addition of this package to the FHS environment of appimage-run: appimage-run: add missing dependency libxshmfence · Issue #476643 · NixOS/nixpkgs · GitHub

This will lead to two appimage-runs, at least use lib.hiPrio on ‌this one or such.

Still, the actual solution is to use https://nixos.org/manual/nixpkgs/stable/#sec-pkgs-appimageTools, not rely on appimage-run.