Nix Cache
This provides a binary cache for nix machines, so they dont have to recompile everything themselves.
Garbage collection#
The cache keeps outputs and derivations in the store, but this can still be garbage collected. if theres something that take a long time to build, you can pin it:
In this example, ZFS takes 45 minutes to compile, but has not been updated since 2024. As infrequently as octopi updates, the artefact gets removed during collection and we want to prevent that.
# Get the derivation path for GC root creation
set -x OCTOPI_DRV (nix path-info --derivation .#nixosConfigurations.octopi.config.system.build.toplevel)
# Create GC root to prevent ZFS rebuilds
ln -s "$OCTOPI_DRV" /nix/var/nix/gcroots/per-user/$USER/octopi-system