pgtk-emacs-flatpak icon indicating copy to clipboard operation
pgtk-emacs-flatpak copied to clipboard

Use binaries inside a toolbx

Open maddovr opened this issue 3 years ago • 7 comments

Is there a way for emacs to use binaries inside a toolbox? I'm aware of your toolbox-tramp package, however if I'm not wrong, that only applies to projects (like visit a file inside a container, and you can work/build it using the container binaries). What I mean is for something like telega/pdf-tools/gnus which look for some host binaries (or even build them themselves) and I was wondering if I could point them to a toolbox instead. This would greatly improve the experience on silverblue and related projects.

maddovr avatar Sep 25 '22 14:09 maddovr

If I understand what you're asking for, and how this works inside a flatpak I'll need to define an extension point and update paths in Emacs to include the extension so gnus(and the rest) can find the relevant binaries. Then separate repos could add the needed binaries

The alternative is to add more modules to the manifest which I am hesitant to do as the final size is already larger than I'd like it to be

fejfighter avatar Sep 26 '22 11:09 fejfighter

As an example, let's say I want to use something like EMMS, it needs a backend, or even multiple ones (like mpd and mpv), then it will also look for things like exiftool and other metadata related binaries. Notmuch mail is also the same, the notmuch.el is just a frontend to the notmuch binary (which you can use in gnus with the gnus-search library). Telega.el is a telegram client for emacs, which will automatically build a binary (called telega-server) by using the installed tdlib (telegram library). pdf-tools is much the same, as it builds its own executable (epdfinfo) by searching for system installed libpoppler etc. These are just examples that comes to mind, but I'm sure there are many others (especially for programming, I'm not sure the flatpak SDKs are the way to go). These could be solved if we could tell emacs to look for those binaries inside a container where we could install them (tho I'm not sure how containers behave with something like mpv tbh). I hope I got my point across.

maddovr avatar Sep 26 '22 14:09 maddovr

I was thinking, since we CAN use toolbox run binary to execute whatever program we want, can we give emacs the permission to run toolbox command? Or look within a toolbox? I'm not sure that would be enough for programs which will build a binary (telega, pdf-tools), but it should be enough for those that look and need a binary (which location can usually be customized through a variable). Thoughts?

maddovr avatar Sep 28 '22 13:09 maddovr

for clarity:

  • there's not an easy way to 'mount' the container inside the emacs flatpak
  • you can do podman mount <container> to the host ans pass it through to the PATH via /var/run/host/<path to container> which is just ugly
  • Extensions might work well for something like webkit, modules or notmuch where building the binary and having the source in one go,(I started down the path with MPD and quickly realised that it was more effort than I was prepared to put in with an early start the next day

I think the method you have proposed would be best for most of the cases listed, but not the ones that rely specifically on libraries rather than binaries.

fejfighter avatar Sep 29 '22 11:09 fejfighter

Using a file in your home folder then inside ~/.bin or ~/.local/bin symlink <mpd/mpv/exiftool/etc> to that script should have it run

toolbox-run.sh:

#!/usr/bin/sh

toolbox run $@

fejfighter avatar Sep 29 '22 11:09 fejfighter

Using a file in your home folder then inside ~/.bin or ~/.local/bin symlink <mpd/mpv/exiftool/etc> to that script should have it run

toolbox-run.sh:

#!/usr/bin/sh

toolbox run $@

While this might just work for notmuch and mpv/d, I don't think it will for telega or pdf-tools. Just tried right now and while this works in a terminal, it doesn't in emacs(.local/bin)? Perhaps emacs needs additional permissions?

maddovr avatar Sep 29 '22 12:09 maddovr

A trivia for telega, it has docker support for its server component (it's actually the recommended way). Making it support podman should be as trivial as a search and replace, however the emacs flatpak can't communicate with it at all. Perhaps something could be done?

maddovr avatar Sep 29 '22 12:09 maddovr