Skip to content

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.

8 points12 comments
Open on Reddit
About this post
Posted
Archived
Edited
Score
8 · 100% up
Kind
Text
ID
eqn490

Author

17
posts
26
comments
1
media
View profile

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

  1. Intro to nspawn
  2. Running GUI apps within nspawn

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!

14 points

machinectl login <user>@<container> can be used to login as a specific user with machinectl but directly starting the container with systemd-nspawn might still be a better option as containers managed with machinectl have to be stored in /var/lib/machines.

2 points

Thanks! This is essentially what i was looking for. I read through the links which look great, excited to try it out.

2 points

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.

5 points

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!

0 points

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.

2 points

I create a pkgbuild just for deps, I know I can uninstall that package and the deps will follow

4 points

This is a great idea. Never used pkgbuid for this purpose but definitely will start to. Cheers!

1 points

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.

2 points

I think it depends on what programming language you're using for developing... I mean, for python there are virtual enviroments, and so on.

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.