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:
parent
89670e27e1
commit
db40fead89
|
@ -110,9 +110,10 @@ in {
|
||||||
systemd.user.services.nix-gc = {
|
systemd.user.services.nix-gc = {
|
||||||
Unit = { Description = "Nix Garbage Collector"; };
|
Unit = { Description = "Nix Garbage Collector"; };
|
||||||
Service = {
|
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
|
lib.optionalString (cfg.options != null) cfg.options
|
||||||
}";
|
}"'');
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
systemd.user.timers.nix-gc = {
|
systemd.user.timers.nix-gc = {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
nix.gc = {
|
nix.gc = {
|
||||||
automatic = true;
|
automatic = true;
|
||||||
frequency = "monthly";
|
frequency = "monthly";
|
||||||
options = "--delete-older-than 30d";
|
options = "--delete-older-than 30d --max-freed $((64 * 1024**3))";
|
||||||
};
|
};
|
||||||
|
|
||||||
test.stubs.nix = { name = "nix"; };
|
test.stubs.nix = { name = "nix"; };
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=@nix@/bin/nix-collect-garbage --delete-older-than 30d
|
ExecStart=/nix/store/00000000000000000000000000000000-nix-gc
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Nix Garbage Collector
|
Description=Nix Garbage Collector
|
||||||
|
|
Loading…
Reference in a new issue