Garbage collection by nixops?

garbage collection is not mentioned in nixops. I wonder how garbage collection is done in nixops deployed machines?

It seemed to me that before I enabled nix.gc.automatic = true; on all my nixops targets /nix/store continued to grow. Since I set this option I haven’t had to do any cleanup. I’ve never actually looked into the code, though, so I’m sure someone can provide a better answer.

it’s really simple:

    systemd.services.nix-gc =
      { description = "Nix Garbage Collector";
        script = "exec ${config.nix.package.out}/bin/nix-collect-garbage ${cfg.options}";
        startAt = optional cfg.automatic cfg.dates;
      };

from nixos/modules/services/misc/nix-gc.nix

In addition to nix.gc.automatic it could be useful to enable nix.optimise.automatic if you want to get every extra free space.