Storage optimization: Difference between revisions

imported>Artturin
move optimizing the store up so that it is more visible and add automatically section
imported>Petersjt014
added a bash alias demonstrating the utility of /nix/var/nix/gcroots
Line 44: Line 44:
/run/booted-system -> /nix/store/8jkrl9jyq7hqxb6xpwcaghpdm26gq98j-nixos-system-iron-16.0916.09pre.custom
/run/booted-system -> /nix/store/8jkrl9jyq7hqxb6xpwcaghpdm26gq98j-nixos-system-iron-16.0916.09pre.custom
/run/current-system -> /nix/store/wmndyzzrbc9fyjw844jmvzwgwgcinq7s-nixos-system-iron-16.0916.09pre.custom</syntaxhighlight>
/run/current-system -> /nix/store/wmndyzzrbc9fyjw844jmvzwgwgcinq7s-nixos-system-iron-16.0916.09pre.custom</syntaxhighlight>
Information about gc roots can be found in <code>/nix/var/nix/gcroots</code>. The following script demonstrates how this directory can be used to (for example) query the state of manually made result symlinks:
<syntaxhighlight lang="bash">find -H /nix/var/nix/gcroots/auto -type l | xargs -I {} sh -c 'readlink {}; realpath {}; echo'</syntaxhighlight>
This acts a simpler (but faster) version of <code>--print-roots</code> and could be implemented as a bash alias for convenience.


=== Run as root ===
=== Run as root ===