Hi, I’m trying to keep my development environment(s) isolated from my host OS; I really like the silverblue + toolbox concept although I’m struggling a bit regarding ‘stuff in my home folder’.
I have several dotfiles which are created/modified in a toolbox. e.g. I want to have sdkman available in a toolbox, but not on my host OS. sdkman requires some initialization in the .bashrc file. I figure that there are many more use cases where the .bashrc file is modified.
How should I manage the isolation of home folder content irt toolboxes??? Especially initialization scripts with environment specific dependencies. A separate home folder seems like a viable solution although, it feels like a hack // me missing the point of toolbox utility.
inside .bashrc you can check if the file is executed inside a toolbox environment. Maybe that helps you at least a bit.
if ! [ -f /run/.containerenv ] \
|| ! [ -f /run/.toolboxenv ]; then
# not executed inside toolbox
alias emacs="flatpak run org.gnu.emacs"
alias vim="flatpak run org.vim.Vim"
alias mutt="toolbox run -c mailbox-2 mutt"
fi
If you dont want to share your home dir with the toolbox you should think about building a container from scratch using podman.
Another idea is to make sure any environment variables controlling where your various development tools put their files are set in you toolbox. I like to do that by stuffing them into /etc/profile.d after I build the container.
I’ll need one based on SDKMAN too shortly, so I started on one here:
This one is based on my own pet container build in order to include various other tools I’d like to have in all of my toolboxes, but I believe this one would also work if based directly on registry.fedoraproject.org/f31/fedora-toolbox.