Flutter App Development in Fedora Silverblue

I’ve experimenting with an approach for IDE’s under Silverblue. The basic idea is that fedora-toolbox exports a magic filesystem $HOME/.local/share/fedora-toobox/env/_default/exe where running binaries actually runs them inside the toolbox. (Executing a binary actually executes a shell script that use flatpak-spawn or podman exec.) Then you can point PATH, JAVA_HOME, etc, to that directory. I’ve tested that the basics work for Java inside of vscode with this approach.

It’s highly experimental - even if you can get it working, it’s probably going to take hours of fiddling, but if you want to try it out, basic instructions would look like:

Inside your fedora-toolbox environment:

  • Install whatever dependencies you need for your envvironment
  • Checkout my ‘toolboxd’ branch of fedora-toolbox: GitHub - owtaylor/toolbox at toolboxd
  • Install the build requirements, and do:
mkdir build
cd build
meson ..
ninja

Outside your toolbox:

cd <path_to_checkout>/build
./toolboxd &
  • check that $HOME/.local/share/fedora-toolbox/env/_default/exe/usr/bin/ps works (should show only a few processes)
  • Change overrides for com.visualstudio.code.oss or com.visualstudio.code (depending on what you are using)
flatpak override <ID> \
      --talk=org.freedesktop.Flatpak \
      --env=PATH=/app/bin:/usr/bin:/app/bin:/usr/bin:$HOME/.local/share/fedora-toolbox/env/_default/exe/usr/bin \
      --env=ENV_ROOT=$HOME/.local/share/fedora-toolbox/env

In vscode:

  • In user settings, set java.home to <your $HOME>/.local/share/fedora-toolbox/env/_default_/exe/usr/lib/jvm/java-11-openjdk-11.0.1.13-4.fc29.x86_64/" (or whatever JAVA_HOME you need)
  • Optional: set: terminal.integrated.shell.linux to <your home>/.local/share/fedora-toolbox/env/_default/exe/usr/bin/bash (this is convenient when you are programming, but not so good for debugging what is going wrong with the setup.)

If you can get that working, congratulations! The eventual idea:

  • Make this a standard part of fedora-toolbox, make launching toolboxd automatic
  • Get support for this integrated into IDE’s or upstream at least the Flatpak packaged versions
  • Support multiple toolboxes, allow someone to provide a Dockerfile/image for “Flutter development” toolbox

So you just run ‘fedora-toolbox create --type=Flutter’, then in vscode workspace settings, select the Flutter toolbox. That’s the dream anyways :slight_smile:

1 Like