Managing packages for project specific purposes

I’m not sure where I should put this, so here we go in the newbie section.

While I usually work at a desktop, I sometimes need to use my laptop for a while. This means that for every project I’m working on I have to set up from scratch the environment to work with, the IDE (along with configuring all preferences and plugins) and all my dependencies.
And this is bad because:

  • I feel I’m wasting a ton of time each time I have to do this
  • It is hard to keep track of the changes made on one device and that I should make to the other (so in the end I will have to go through everything, and it will be just as long as setting it up from scratch)
  • While for my desktop I’m extremely comfortable with Endeavour and everything works perfectly, I have the bad habit of distro-hopping on my laptop and things usually become a mess.

The same problem also applies every time anyone else joins in.

Aside from porting everything from one place to another, I also tend to download lots of packages which I will probably never use again and just forget them there as soon as I am done.
I think it would be very useful to have a way to say for which project I downloaded which package so that they can be removed when they are not used anymore.

I’ve thought of using either docker or virtual machines but I’m still not sure.
To be honest, I think virtual machines (although they are most likely to work because I can just pass them wherever I need to work) are a bit of an overkill (especially because I’m worried my laptop may not be able to handle one).
But on the other hand, I’m not sure putting my IDE and everything inside a docker container is a really good idea.

I very hope someone with more experience than me already encountered this kind of annoyances and has tips on this regard.

VM’s are the first thing I would try - though not in VirtualBox if the laptop is performance challenged! I suspect the best performance is found in a virtmanager setup.

The advantage is that once you have ‘cloned’ your starting point, you can work on copies of it as many times as needed, without ‘losing’ it - which should be a help.

Others have more expertise in this than I do (I tend to just throw another complete build on bare metal for one-offs, as I can build a setup in under 20 minutes (less if hurried), and lose no performance being on bare metal. REFIND handles the boot choices quite nicely…

Anyway - hopefully a future responder will have more experienced advice to offer…

One idea, provided you have the required programming knowledge, is to write a script (using bash, python, perl, or something else) which does all app installs and configs. Then the same script can revert all changes when you no more need them.

You just need to write all phases. But you already do those things manually, so simply writing them to a script shouldn’t be too challenging…

The good part is that you can easily make all changes with the script.

But of course writing the script takes time to get all to your liking.

Use git to keep track of the changes.

I was kinda already thinking of this, although more than the technical requirements, I would worry about how different pieces of software store their configuration and allow third party scripts to edit them.

For instance, while it may be easy to write a script that changes my “.vimrc” file, I am not sure about how hard it would be to change the configuration of less terminal-centric software (Such as CLion, IntelliJ or Pycharm; Codium might be an exception) that do not provide actual ways to easily edit their configuration from the command line.

This aside, having different environments between my laptop and my desktop (and probably between most people I will work with as well) running a script may end up with unexpected results, and I am quite sure trying to handle the possible scenarios may prove inefficient for its purpose.
For instance, having a different package manager may already break my script if not handled. Or even different mount points for external drives (I did have different mount points at some point, but whatever).
This is why my possible solutions focussed on preparing the same exact environment before setting everything up (docker) or passing the same exact working environment already set up (The virtual machine idea).

In either way, I will try this and see how this works. Hopefully, if it does work as expected, this might actually be the most well performing solution!