From 5310716620f43a66bc75f2a47506cec6531eb7bf Mon Sep 17 00:00:00 2001 From: Jan Grosser Date: Sun, 26 May 2024 22:37:45 +0200 Subject: [PATCH] Updated/corrected section garbage collection --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4384cd4..ac936e8 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ My NixOS configuration repository 4. Apply changes: `sudo nixos-rebuild switch` and reboot 5. Clone NixOS config repository to /home/$USER/nixos: ``` -cd +cd $HOME git clone https://git.plueschbit.de/jan/nixos-conf ~/nixos ``` 6. Add the new host to repository @@ -29,6 +29,7 @@ git clone https://git.plueschbit.de/jan/nixos-conf ~/nixos ## Update Packages on a Host Update of the file `flake.nix`: ``` +cd ~/nixos sudo nix flake update ``` Then, perform nixos rebuild: @@ -37,8 +38,13 @@ sudo nixos-rebuild switch --flake ~/nixos/# ``` ## Garbage Collection +List all generations: +``` +sudo nix-env --list-generations --profile /nix/var/nix/profiles/system +``` + Keep e.g. the last five generations and perform garbage collection: ``` -sudo nix-env --delete-generations +5 -sudo nix-store --gc +sudo nix-env --delete-generations +5 --profile /nix/var/nix/profiles/system +sudo nix-collect-garbage ```