Storage optimization: Difference between revisions

DoggoBit (talk | contribs)
Garbage collection: In general a user reading this section will care about removing old NixOS generations first. Thus, I moved the section above the GC roots details
m rm deprecated link to options: min-free, max-free. Replaced with link to `nix.extraOptions` with correct template
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Merge|Nix store}}
A recurring problem with NixOS is lack of space on <code>/</code>. Even if you only occasionally use Nix, it is easy for <code>/nix/store</code> to grow beyond reasonable sizes. What follows are generic notes on how to reduce the growth of the [[Nix store]].  
A recurring problem with NixOS is lack of space on <code>/</code>. Even if you only occasionally use Nix, it is easy for <code>/nix/store</code> to grow beyond reasonable sizes. What follows are generic notes on how to reduce the growth of the [[Nix store]].  


Line 144: Line 146:
This can result in redownloads (tarballs fetched with <code>import (builtins.fetchTarball ...)</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.fetchTarball ...)</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:
It is also possible to automatically run garbage collection whenever there is not enough space left.<ref group="cf.">{{Nixos:option|nix.extraOptions}}: min-free and max-free</ref> For example, to free up to 1GiB whenever there is less than 100MiB left:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">