Automatic garbage collection with package manager only

When running nixos, garbage collection can be automated by setting “nix.gc” attributes in “configuration.nix” and nix store optimisation can be automated using “nix.optimise.automatic = true;”.

For a package manager only installation on Linux, there also exists “auto-optimise-store” in nix.conf. But there appears to be no setting for automatic garbage collection. What is the recommended way to setup automatic garbage collection for a package manager only installation?


nix.gc basically sets up a systemd service to run nix-collect-garbage every so often, so you could just set up such a service and timer on any other system, too.


Thanks for your reply. I just wanted to make sure I wasn’t missing some built-in way to do it.