Created
April 26, 2018 22:54
-
-
Save elaOnMars/e02f03174730a09af7138cae9f87cd8e to your computer and use it in GitHub Desktop.
NixOS Wiki
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## View NixOS builds: | |
| ls -l /nix/var/nix/profiles/ | |
| <snip> | |
| lrwxrwxrwx 1 root root 14 25. Apr 01:29 default -> default-1-link | |
| lrwxrwxrwx 1 root root 60 25. Apr 01:29 default-1-link -> /nix/store/1ny6g20kvqq5xq0vrby49k6alpa76xhn-user-environment | |
| drwxrwxrwt 6 root root 4096 25. Apr 18:21 per-user | |
| lrwxrwxrwx 1 root root 13 25. Apr 16:49 system -> system-9-link | |
| lrwxrwxrwx 1 root root 88 24. Apr 15:49 system-1-link -> /nix/store/jvl660mg3xhh5mq5hrnwjc3qmvr2i3j-nixos-system-me-18.03.131807.489a14add9a | |
| lrwxrwxrwx 1 root root 88 24. Apr 16:25 system-2-link -> /nix/store/61q3125mq5hrnwkaml9hr18vyz1i6kh1-nixos-system-me-18.03.131807.489a14add9a | |
| lrwxrwxrwx 1 root root 88 24. Apr 17:04 system-3-link -> /nix/store/prk88pz5mq5hrnwffmp5bkbrxywfawl-nixos-system-me-18.03.131807.489a14add9a | |
| </snip> | |
| or | |
| nix-env -p /nix/var/nix/profiles/system --list-generations | |
| <snip> | |
| 0 default | |
| 4,0K default-1-link | |
| 180K per-user | |
| 0 system | |
| 4,0K system-1-link | |
| 4,0K system-2-link | |
| 4,0K system-3-link | |
| </snip> | |
| To have an idea which programs are actually installed in | |
| each build run | |
| ls on the sw/bindirectory of the system links. | |
| Remove build #2 and the files with it: | |
| $ nix-store --delete /nix/store/prk88pz5mq5hrnwffmp5bkbrxywfawl-nixos-system-me-18.03.131807.489a14add9a/ | |
| finding garbage collector roots... | |
| 0 store paths deleted, 0.00 MiB freed | |
| error: cannot delete path '/nix/store/prk88pz5mq5hrnwffmp5bkbrxywfawl-nixos-system-me-18.03.131807.489a14add9a' since it is still alive | |
| # Check if this build is active: | |
| $ nix-store --query --roots /nix/store/prk88pz5mq5hrnwffmp5bkbrxywfawl-nixos-system-me-18.03.131807.489a14add9a/ | |
| /nix/var/nix/profiles/system-2-link | |
| $ | |
| An active build would look like: | |
| /nix/var/nix/profiles/system-5-link | |
| /run/booted-system | |
| $ | |
| # Remove system-2-link also if it marked as active: | |
| $ nix-env -p /nix/var/nix/profiles/system --delete-generations 2 | |
| # To remove system-5-link run | |
| $ nix-env -p /nix/var/nix/profiles/system --delete-generations 5 | |
| # To free up space run again: | |
| $ nix-store --delete /nix/store/prk88pz5mq5hrnwffmp5bkbrxywfawl-nixos-system-me-18.03.131807.489a14add9a | |
| finding garbage collector roots... | |
| removing stale link from '/nix/var/nix/gcroots/auto/vzqgby05kf44a8dfi4fr0rf0y1zfyn9f' to '/tmp/nixos-rebuild.YLJWU0/nix.drv' | |
| removing stale link from '/nix/var/nix/gcroots/auto/fqbzfzxcgykd9xkv3kzfxrnv8h6q1d8i' to '/tmp/nixos-rebuild.YLJWU0/nix' | |
| deleting '/nix/store/prk88pz5mq5hrnwffmp5bkbrxywfawl-nixos-system-me-18.03.131807.489a14add9a' | |
| deleting '/nix/store/trash' | |
| deleting unused links... | |
| note: currently hard linking saves 1858.32 MiB | |
| 1 store paths deleted, 0.04 MiB freed | |
| # Deleting the 2nd generation made more garbage. You need to remove it with: | |
| $ nix-collect-garbage | |
| finding garbage collector roots... | |
| deleting garbage... | |
| deleting '/nix/store/nmmb8rf1rkazgcs2myfabp74xr80f8wr-linux-4.14.34-rt27.lock' | |
| deleting '/nix/store/nw6f7max04q2lwxc7lslv4mm5r8hq6r8-linux-4.14.34-rt27-dev.lock' | |
| deleting '/nix/store/i8jhy3mz6bnzh9la5vv9cp4cpw0dqgkf-nixos-system-gudrun-18.03.132083.06c576b0525.drv' | |
| deleting '/nix/store/xbmz2gbbn83zr7039xxrp3wx2kdk22hi-etc.drv' | |
| deleting '/nix/store/4flyh7mjrdybw8w1zi912flin3p0kjpy-system-units.drv' | |
| ... | |
| deleting unused links... | |
| note: currently hard linking saves 1777.59 MiB | |
| 146 store paths deleted, 435.51 MiB freed | |
| Alternatively you can run | |
| $ nix-collect-garbage --max-freed 1g |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment