Skip to content

Automatic garbage collection #42

@Tommixe

Description

@Tommixe

Hello,
does the option "--delete-older-than +3" (with the +3 argument) work for you in the garbage collection service?(hosts/common/global/nix.nix file)

gc = {
automatic = true;
dates = "weekly";
# Keep the last 3 generations
options = "--delete-older-than +3";
};

I get an error since the command nix-collect-garbage expect a period, like 14d, and not a number of generations to keep.

gen 08 15:51:56 ws02 nix-gc-start[5075]: removing old generations of profile /nix/var/nix/profiles/system
gen 08 15:51:56 ws02 nix-gc-start[5075]: error: invalid number of days specifier '+3', expected something like '14d'
gen 08 15:51:56 ws02 nix-gc-start[5075]: Try '/nix/store/yskyk1xf37fzf525xdppblg0qlji2nrf-nix-2.24.11/bin/nix-collect-garbage --help' for more information.
gen 08 15:51:56 ws02 systemd[1]: nix-gc.service: Main process exited, code=exited, status=1/FAILURE

Looking at the documentation it seems that only the command nix-env --delete-generations accept + argument.

Thanks for your amazing work!
Tommaso

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions