nix-gc: call nix-collect-garbage in a shell script

This will match the behavior in the upstream service which allows the
user to set options to something that uses shell syntax.
This commit is contained in:
Ninja3047 2024-07-22 21:51:02 -04:00 committed by Robert Helgesson
parent 89670e27e1
commit db40fead89
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
3 changed files with 5 additions and 4 deletions

View file

@ -110,9 +110,10 @@ in {
systemd.user.services.nix-gc = {
Unit = { Description = "Nix Garbage Collector"; };
Service = {
ExecStart = "${nixPackage}/bin/nix-collect-garbage ${
ExecStart = toString (pkgs.writeShellScript "nix-gc" ''
exec "${nixPackage}/bin/nix-collect-garbage ${
lib.optionalString (cfg.options != null) cfg.options
}";
}"'');
};
};
systemd.user.timers.nix-gc = {