Arch developers how do you manage system level dependencies for coding projects
I use a virtual environments with an isolated package manager to manage dependencies for coding projects, to keep things clean and separate from system dependencies. But sometimes for coding packages to compile and install correctly they require system level dependencies. How do you go about handling such a scenario? Ideally i would like them to be seen as dependencies without being seen as orphans.
Edited 18 Jan 2020. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 8 · 100% up
- Kind
- Text
- ID
- eqn490
12 comments
Apart from Docker containers (that I also use) you can also consider using systemd-nspawn. I personally find it a bit easier to work with and is ideal for development environments rather than projects.
It is essentially a bare bones system VM that can be used to test packages and for development. It gives me the ability to experiment without worrying that I will mess up my host system dependencies. I can keep it as long as needed and is directly accessible from a file explorer. This means I can easily copy dotfiles over to carry over editor configurations etc.
Read more about it on the wiki here but also recommend reading these two blog articles as well
Some quick tips:
machinectl can only manage your containers if they are stored under /var/lib/machines but that is only accessible by root so it will be a pain to access the filesystem. Create the container under your home directory and then symlink the folder to the var location and machinectl will be able to see the images.
I always use systemd-nspawn command to log into the container rather than machinectl since that allows me to define my test user and not login as root. machinectl login command seems to be a bit buggy.
What I essentialy do is create a container let's say for rust projects then in that container install all rust dependencies such as rustup etc and have my vim editor only setup for rust so all my rust projects live under that environment. I do the same for all languages I work with isolating dependencies editor configs virtually everything.
I also believe you can run docker within nspawn so you don't even need docker on your host machine but that might be an overkill.
Hope this helps!
machinectl login <user>@<container>can be used to login as a specific user withmachinectlbut directly starting the container withsystemd-nspawnmight still be a better option as containers managed withmachinectlhave to be stored in /var/lib/machines.Thanks! This is essentially what i was looking for. I read through the links which look great, excited to try it out.
You could develop inside a container. Docker is more ephemeral by default but you can still launch persistent containers to develop in. LXD is more like a VM and targeted toward pet containers. Docker is a good skill to have for containerizing your own applications.
I use docker a lot for projects when I know there are a lot to dependencies or I need a client to use without a fuss or if I want it to run at startup. But perhaps I should integrate it into my workflow more freequently. This may be the best solution but creating a docker image for smaller projects that have only a few dependencies does make me second guess my OCD. Thanks for the suggestion!
Take a look at toolbox from Fedora. Not necessary to use but that same workflow works pretty well. Use the containers for specific toolchains not apps.
If you want to keep it on your host machine, you can also look at asdf which is very cool.
I create a pkgbuild just for deps, I know I can uninstall that package and the deps will follow
This is a great idea. Never used pkgbuid for this purpose but definitely will start to. Cheers!
I just install them. For complex projects with many dependencies I create a meta package which requires all needed dependencies. So I can easily uninstall it when the project is over.
I think it depends on what programming language you're using for developing... I mean, for python there are virtual enviroments, and so on.
I think you are looking for https://wiki.archlinux.org/index.php/DeveloperWiki:Building_in_a_clean_chroot
Check out the devtools package