I have some large packages (particularly JetBrains IDEs) taking up a large amount of space. These then double in storage requirement when I rebuild which is particularly frustrating on installations with less allocated space. While I understand that this may go against Nix principles, is there any way to make some non-critical packages of my choosing update in place i.e. uninstall the old version and then install the new one?
Definitely make sure you enable nix.settings.auto-optimise-store
, this deduplicates identical files at least.
There’s also nix.settings.max-free
to automatically garbage collect unneeded store paths.
Existing versions can no be removed when they are a dependency of the running system, but you can work around this with a two-step-rebuild:
Comment out the IDEs from the config, rebuild, do (manual) garbage collection, revert the config changes and rebuild again.
I’m aware of this however this doesn’t solve my problem of large packages needing to exist twice on disk during an update
Is there no automated way to do this?
Not that I am aware of. Your best bet might be to create a minimal config and alternate between minimal an production config when updating, with a GC step in between.
Consider also having separately the system config, and separately a buildEnv
with the large non-critical tools to nix-build
with a symlink going into /opt/tools/
or something. In that case removal of the symlink, GC, system rebuild, additional tools rebuild can be scripted more easily and safely.