[Nix-dev] Automatic garbage collection vs. systemd

Peter Simons simons at cryp.to
Sun Oct 20 17:33:19 CEST 2013


Hi guys,

I used the following snipped in /etc/nixos/configuration.nix to ensure
that my machine always has about 15GB of free disk space:

  nix.gc = {
    automatic = true;
    dates = "05,11,17,23:15";
    options = ''--max-freed "$((15 * 1024**3 - 1024 * $(df -P -k /nix/store | tail -n 1 | ${pkgs.gawk}/bin/awk '{ print $4 }')))"'';
  };

It seems, though, as if that configuration no longer works:

  # journalctl _SYSTEMD_UNIT=nix-gc.service
  [...]
  Oct 19 05:15:00 hydra nix-collect-garbage[21595]: error: `--max-freed' requires an argument
  Oct 19 05:15:00 hydra nix-collect-garbage[21595]: Try `nix-store --help' for more information.

Is it possible that the "ExecStart" field used to define nix-gc.service
stopped accepting shell syntax like $((...)) at some point?

Is this a new systemd "feature"?

Take care,
Peter



More information about the nix-dev mailing list