I (mostly) use Vim, and it’s available on Flathub. However: my plugins are managed with Vundle, which shells out to git to download and update them. But git is not in the org.freedesktop.Platform runtime that the Vim Flatpak uses, so that’s not going to work!
If you’ve read any of my recent posts about Flatpak, you’ll know my favourite hammer. I allowed Vim to use flatpak-spawn by launching it as:
flatpak run --talk-name=org.freedesktop.Flatpak org.vim.Vim
I saved the following file to /tmp/git:
#!/bin/sh exec flatpak-spawn --host git "$@"
then ran the following Vim commands to make it executable, add it to the path, then fire up Vundle:
:r !chmod +x /tmp/git :let $PATH = '/tmp:/app/bin:/usr/bin' :VundleInstall
This tricks Vundle into running git outside the sandbox. It worked!
I’m posting this partly as a note to self for next time I want to do this, and partly to say “can we do better?”. In this specific case, the Vim Flatpak could use org.freedesktop.Sdk as its runtime, like many other editors do. But this only solves the problem for tools like git which are included in the relevant SDK. What if I’m writing Python and want to use pyflakes, which is not in the SDK?
Well, that’s interesting — to follow up to your remark about pyflakes, when I packaged Sublime Text I also created an extension point for plugins and packaged up all the Python and NodeJS modules (such as pyflakes and other linters) that I usually use with that editor in an extension. It would certainly be easier if the Sublime Text flatpak could use host tools. (Unless you’re on an immutable system where you can’t install tools on the host.)
I am on such a system ☺ but I cheat and use
pip3 install --user flake8
. The app-extension-point approach is nice but we’d need (number of languages/ecosystems) × (number of editors). Or, we could make an SDK extension for each language/ecosystem, make the editors use org.freedesktop.Sdk or org.gnome.Sdk as the runtime (VSCode uses the former; Builder the latter), and teach each editor’s launcher script to add any installed extensions to the$PATH
. O(n + m) rather than O(n × m) work! Still requires the editor user to have knowledge of how Flatpak works, though…I think we’ve discussed this before, but if I were doing (non-OS) Python development on Endless OS, I’d probably want to use Anaconda to install the required Python version into $HOME, at which point we’re back at “put
flatpak-spawn --host
in front of every command”!