Storage optimization: Difference between revisions
imported>Mth mNo edit summary |
imported>Mth automatically run garbage collection whenever there is not enough space left |
||
| Line 85: | Line 85: | ||
This can result in redownloads (tarballs fetched with <code>import (builtins.fetchFromTarball ...)</code> for example are not referenced anywhere and removed on GC), but it frees you from runnning GC manually. | This can result in redownloads (tarballs fetched with <code>import (builtins.fetchFromTarball ...)</code> for example are not referenced anywhere and removed on GC), but it frees you from runnning GC manually. | ||
It is also possible to automatically run garbage collection whenever there is not enough space left.<ref group="cf.">{{nix:option|min-free}} and {{nix:option|max-free}}</ref> For example, to free up to 1GiB whenever there is less than 100MiB left: | |||
<syntaxhighlight lang="nix"> | |||
nix.extraOptions = '' | |||
min-free = ${toString (100 * 1024 * 1024)} | |||
max-free = ${toString (1024 * 1024 * 1024)} | |||
''; | |||
</syntaxhighlight> | |||
This is particularly useful when the store is on its own partition, see [[#Moving_the_store|below]]. | |||
== Moving the store == | == Moving the store == | ||