Skip to content

Commit

Permalink
Add cleanup commands to NixOS.md
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipMay committed Dec 20, 2023
1 parent 7285237 commit 6cc7a38
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/linux/nixos.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [SSH public key authentication](https://nixos.wiki/wiki/SSH_public_key_authentication)
- [Nixpkgs Manual](https://nixos.org/manual/nixpkgs/stable/)
- [Nix Reference Manual](https://nixos.org/manual/nix/stable/)
- [Main Commands](https://nixos.org/manual/nix/stable/command-ref/main-commands#main-commands)
- Searches
- Packages: https://search.nixos.org/packages
- Options: https://search.nixos.org/options
Expand All @@ -26,6 +27,15 @@
- list available profiles: `nix-env --list-generations --profile /nix/var/nix/profiles/system`
- update the system: `nixos-rebuild switch --upgrade`

## Cleanup
- delete generations from the current profile
- delete all except current: `nix-env --delete-generations old`
- delete generations more than 14 days ago: `nix-env --delete-generations 14d`
- keep last 2 generations, along with any newer than current: `nix-env --delete-generations +2`
- after removing old generations run garbage collector: `nix-store --gc`
- delete unreachable store objects: `nix-collect-garbage -d`
- <https://nixos.org/manual/nix/stable/package-management/garbage-collection>

## Installation

- [Installing from another Linux distribution](https://nixos.org/manual/nixos/stable/#sec-installing-from-other-distro)
Expand Down

0 comments on commit 6cc7a38

Please sign in to comment.