Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

infra.nix

1 options

infra.nix.gc.keepGenerations

How many system-profile generations to keep, regardless of age.

Trimmed immediately before each automatic GC run (as an ExecStartPre on nix-gc.service) so the collector frees the unlinked paths in the same pass.

This bounds what the age window cannot. --delete-older-than is purely age-based, so a host deployed a dozen times inside the retention window keeps a dozen generations, all of them “recent”. The two bounds compose: a generation is kept only if it is both young enough and new enough.

Set to null to disable the count bound and retain by age alone. Has no effect when nix.gc.automatic is false.

Type: null or (positive integer, meaning >0)

Default:

10

Example:

3

Declared by: nix/modules/infra/base/core/gc.nix