1
0
Fork 0

Updated/corrected section garbage collection

This commit is contained in:
Jan Grosser 2024-05-26 22:37:45 +02:00
parent f022c41835
commit 5310716620

View file

@ -16,7 +16,7 @@ My NixOS configuration repository
4. Apply changes: `sudo nixos-rebuild switch` and reboot 4. Apply changes: `sudo nixos-rebuild switch` and reboot
5. Clone NixOS config repository to /home/$USER/nixos: 5. Clone NixOS config repository to /home/$USER/nixos:
``` ```
cd cd $HOME
git clone https://git.plueschbit.de/jan/nixos-conf ~/nixos git clone https://git.plueschbit.de/jan/nixos-conf ~/nixos
``` ```
6. Add the new host to repository 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 Packages on a Host
Update of the file `flake.nix`: Update of the file `flake.nix`:
``` ```
cd ~/nixos
sudo nix flake update sudo nix flake update
``` ```
Then, perform nixos rebuild: Then, perform nixos rebuild:
@ -37,8 +38,13 @@ sudo nixos-rebuild switch --flake ~/nixos/#<host>
``` ```
## Garbage Collection ## 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: Keep e.g. the last five generations and perform garbage collection:
``` ```
sudo nix-env --delete-generations +5 sudo nix-env --delete-generations +5 --profile /nix/var/nix/profiles/system
sudo nix-store --gc sudo nix-collect-garbage
``` ```