Nix Package Manager Housekeeping

Share on:

How to clean up a Nix environment on (Debian Bookworm).

In the blog post Getting started with Nix Package Manager we covered how to install Nix. A quick follow up on that post to discuss how to clean up the environment.

The more you use Nix, the more relevant this post will be. So I separated out the details for the time you need to quickly remove the cache on your machine.

Nix Housekeeping

Now you have sampled Nix, its time to clean up the cache. Nix will store the packages ready for the next run. Lets get rid of this cache.

  1. Use the nix-collect-garbage command
1nix-collect-garbage

The command will remove the current files.

  1. If you want a deep clean you can also append the -d parameter The -d parameter means to perform a deep clean, i.e. remove anything not being used.
1nix-collect-garbage -d