Storage optimization: Difference between revisions

imported>LucasWagler
m Wording in Automatic Optimisation
No edit summary
Line 3: Line 3:
== Optimising the store ==
== Optimising the store ==
Here we demonstrate how to configure <code>nix</code> to save space via hardlinking store files.  
Here we demonstrate how to configure <code>nix</code> to save space via hardlinking store files.  
 
r
=== Automatic ===
=== Automatic ===
To turn on periodic optimisation of the nix store, set the following option in <code>/etc/nixos/configuration.nix</code>:
To turn on periodic optimisation of the nix store, set the following option in <code>/etc/nixos/configuration.nix</code>:
Line 193: Line 193:
</syntaxhighlight>
</syntaxhighlight>
# Copy everything from <code>/nix</code> to <code>/mnt</code> ''Trailing slashes are important'', in that without them, <code>rsync</code> will create an additional directory of the same name at the destination. <syntaxhighlight lang="console">
# Copy everything from <code>/nix</code> to <code>/mnt</code> ''Trailing slashes are important'', in that without them, <code>rsync</code> will create an additional directory of the same name at the destination. <syntaxhighlight lang="console">
# rsync --archive --acls --one-file-system --verbose /nix/store/ /mnt/store
# rsync --archive --hardlinks --acls --one-file-system --verbose /nix/store/ /mnt/store
# rsync --archive --acls --one-file-system --verbose /nix/var/ /mnt/var
# rsync --archive --hardlinks --acls --one-file-system --verbose /nix/var/ /mnt/var
</syntaxhighlight>
</syntaxhighlight>
# Mount the new partition as the new <code>/nix</code> <syntaxhighlight lang="console">
# Mount the new partition as the new <code>/nix</code> <syntaxhighlight lang="console">