Development on Silverblue, how does it work?

So I had to do a lot of searching to find out how to use oh-my-zsh in the terminal using “flatpak spawn”. I am not sure if this is the best way.

But the most important thing for me is tools like nvm, nodejs, etc

At the moment I am having to reinstall all of these every time I boot.

Is there a way I can have them persist? Is installing them from rpm-ostree the best bet here?

I recommend reading all the Silverblue User Guide, especially the section on toolbox. It isn’t very long and will most likely answer most of your questions. A general rule of thumb is to avoid rpm-ostree install at all costs, as having too many packages overlaid defeats the point, and may lead to problems later on.

2 Likes

Thank you!

Yeah, I was aware that you’d lose out on the advantages but was worried there wasn’t another way.

Will read all the way through it :slight_smile:

1 Like

More than 10 years ago, I realized that I had a dead hard drive once every year or two, and I needed to reinstall and reconfigure everything, a process that usually took a better part of a month.

That nudged me to custom partition setups (e.g. having a separate partition for each home), using of portable apps (software that you do not install at the OS level, but merely unpack in a chosen folder and execute it from there), apps that will set all their needed configs and plugins inside your homedir, and virtual machine for special tools (including a Windows virtual machine when I need to test the software I build on a Windows).

How is this relevant to your question? Well, an immutable OS like Silverblue is nudging you to do the same thing. Leave the OS untouched, and do the most you can in containers, flatpaks and some portable apps.

I mostly develop in Java. I have a portableapps folder in my homedir where I have many apps that are happy to work that way. I have eclipse downloaded as a zip and unpacked there, 3-4 years ago, setup with all plugins I need, and I just run it from there every day. I don’t upgrade it unless I have to. If I have to, I download the new version in a new dir, and make it use a new workspace. I use sdkman to install as many Java versions I need inside my user profile and easily switch between them whenever I need. I have maven unpacked in the portable dir. I have several unpacked version of the Tomcat.

You asked about nodejs. I don’t use it much, but when I needed it, it worked just fine when unpacked in the portableapps dir.

In addition to such setup with portable apps, which is a good practice for any developer (even on Windows, as I started working that way 15 years ago on Windows), immutable OS like Silverblue (with podman and toolbox readily available) helps quite a lot with making containers at your fingertips.

I now have a dozen of containers (setup with podman) for some specific things that are harder to setup as portable apps manually (e.g. container for postgresql database for application A, another one for the database for application B with some specific plugins, another one for a test-bed authentication web server, another one for PHP, another one for Perl cgi-bin development).

So the OS is stable, and you install all the experimental software that as a developer you need to have installed and to experiment with, in places where it can’t do damage to do OS. Yes, in containers.

So that’s why I think that although Silverblue will be great for people that are illiterate, so that they can not damage the system, it is even better for developers, because it nudges your towards a better way to do things.

There are issues and some annoyances. Due to restrictions some flatpak apps do not remember the last folder you used to save some downloaded file, so that they offer some internal contained folder, and you have to navigate to the Documents/subfolder you need repeteadly again and again and again on each file save. Some flatpak apps do not communicate well with regular apps (e.g. browser and password manager via some specific protocol). Some apps that are distributed as rpm can not be installed via rpm-ostree due to mismatch of lib versions, or might prevent future upgrdes via rpm-ostree upgrade, so I had to install them inside “toolbox”. But running a GUI app inside toolbox turned to be rather slow (I have yet to find time to investigate why and what can I do to fix it).

Still, I am on Silverblue and Kinoite variant as a daily driver now, for several months, doing teaching online classes and development. I don’t have another OS to boot from, so whatever happens I have to endure it and fix it. I change distribution or hardware on yearly basis, just to keep me fit. The process is easy, due to the way I have partitions and portable apps setup.

3 Likes

Thanks for all the information!

It’s really cool how you organically came to the same solution as Silverblue.

I’m getting more and more convinced by the SilverBlue way as I use it.

I don’t know if it was the best way, but I was able to have NVM persistent along with npm, yarn et all by adding this to my .zshrc script

export NVM_DIR="/var/home/sashin/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

I haven’t fully figured out toolbox yet, the guide wasn’t much to go on for me. It doesn’t seem like things installed in a toolbox container persist between reboots, hmmm

Packages installed to a toolbox container are persistent. As long as the container itself is not destroyed.

1 Like

Where is the container?

I don’t know where the container image is actually stored.

The default toolbox container can be accessed by running
toolbox enter

Once inside, we can do the normal dnf install, and run the installed packages inside the container.

We can even run apps inside a toolbox container without entering it by toolbox run

When we just run toolbox for the first time, it will prompt us to create our default toolbox container, by running toolbox create

1 Like

Where is the container?

.local/share/containers/…

If you need more details. Run the following command to list all the containers:

podman container list -a

Then follow-up with the next command to inspect the configuraiton of a certain container

podman inspect containerNameOrID

3 Likes

Is podman the same as toolbox?

Toolbox and Podman are both container management tools.

Toolbox is more simple.

Podman can also manage containers created by toolbox.

1 Like

Toolbox is a convenience tool that uses podman to create and configure podman containers for you. The containers are integrated with your host OS in such a way that you can run graphical apps inside them. Your home folder (with some other folders) is mounted inside the containers also. The containers created by toolbox are meant to be used as throwaway development environments, but you can also try to install software in there that you do not want to overlay in silverblue. It works quite well most of the times now. I can even launch and play games from toolbox on my PC.

2 Likes