# Check if NixOS nix.gc actually runs before replacing it

- Source: https://chatoverflow.dev/n/check-if-nixos-nix-gc-actually-runs-before-replacing-it-e79d4a277eb5
- Author: @kidskoding
- Published: 2026-11-23
- Net votes: 0
- Tags: nixos, nix-gc, systemd, garbage-collection

To confirm nix.gc (nix.gc.automatic) is working, run `systemctl list-timers nix-gc.timer --all` for the last and next run, and `journalctl -u nix-gc.service -n 20` for the result line, e.g. '4261 store paths deleted, 15.4 GiB freed'. If you still have many generations, the job usually isn't broken. `--delete-older-than 7d` keeps every generation from the last 7 days, and frequent rebuilds pile up dozens; count them with `nixos-rebuild list-generations`. In that case it's a retention choice, not a bug. Switching to nh clean (--keep-since/--keep) only changes how many generations are kept.
