Questions about Software Development on Silverblue

Hello all, aspiring Software Developer here. I had a few questions about developing software on Silverblue. Specifically to deal with containers using Toolbox. I haven’t had a lot of experience yet with using containers for development but considering Silverblue is kinda based around it now seems to be as good a time as any. Based on what I’ve read it seems simple enough. There are a couple of specific questions I had about it though.

  1. Would I install the programming language in the base install or would I install that inside the container? Or would I find a container image that already has the language included?
  2. My preferred development environment for Rust involves using Visual Studio Code with the RLS plugin, which also requires the RLS to be installed on the host computer. In order to use that would I need to install all of that inside the container or could VSCode utilize the RLS running inside the container? (If the answer to the first question is “install language inside container”).

Any help would be much appreciated.

1 Like

(1) You would preferably install a programming language in a container. Toolbox affords you some convenience as it works similarly to a conventional Fedora Workstation install: you can install packages with dnf and many things should work out of the box. Toolbox gets this convenience somewhat at the expense of running podman with --privileged, sharing the host network with the container, and mounting the home directory in the container, among other compromises.

Building your own container images gives you increased security and other benefits of containers, such as declarative configuration. There are two approaches with podman. The simplest is to write a Dockerfile that initializes a build stage from a base image and runs commands to install packages and add users, set an entry point, or add labels. The other approach is to use buildah. If you use buildah, you can start from a base image, but you can also build an image from scratch, which allows you to make a smaller image. In either case, the image is built by running commands in the container.

You certainly can start from a base image that already includes the programming language, and there are many on Docker Hub and the Fedora Container Registry.

(2) If Visual Studio Code is installed as a Flatpak, for now there is no way to use the language server. You can install Code in a non-Flatpak container (which is inconvenient, as it will not integrate with menus or the file browser) or on the host system (but then you need to install the language server on the host system too).

3 Likes

Ok, so I should probably just adjust to not using RLS then, I can manage that, I believe the benefits of SilverBlue are worth it. Thanks. I don’t work on a large amount of projects with one particular stack or dependencies, so trying to get fancy with containers probably isn’t worth it at this stage, just using the default toolbox ones will be fine for now. I appreciate the feedback you’ve given me though, and I will keep it in mind for the future.

If you are willing to install ssh server on your toolbox container, you can eventually use the new remote development mode in VSCode Remote Development with Visual Studio Code. It’s not in stable yet, still in VSCode insiders.

But in the meantime, you can install VSCode in the toolbox container. I’ve done that before and it works well. Except you need to use same VSCode installation across containers.

I actually found another solution that works for me for the time being. I take advantage of VS Code’s workspaces to set up ShellArgs to launch the toolbox for a particular project with flatpak-spawn --host toolbox enter -c <name> works pretty well so far from my experience. Eventually I may expand this to write a script that will set up a vscode workspace file and create a container. Maybe even enter it and install language runtimes and the like. Really digging silverblue so far. I will keep the remote development mode in mind. Thanks for the suggestion!

1 Like