diff --git a/source/linux/nixos.md b/source/linux/nixos.md index 5a56f61..5025a11 100644 --- a/source/linux/nixos.md +++ b/source/linux/nixos.md @@ -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 @@ -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` +- + ## Installation - [Installing from another Linux distribution](https://nixos.org/manual/nixos/stable/#sec-installing-from-other-distro)