From 5c4fd77097e2cecfd4780e099af7954f86779fe1 Mon Sep 17 00:00:00 2001 From: Thiago Jung Bauermann Date: Wed, 15 Sep 2021 20:36:38 -0300 Subject: etc: Add systemd files for running ‘guix gc’ periodically MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * etc/guix-gc.service.in: New file. * etc/guix-gc.timer: Likewise. * .gitignore: Ignore generated ‘guix-gc.service’. * nix/local.mk (nodist_systemdservice_DATA): Add ‘guix-gc.service’ and ‘guix-gc.timer’. (EXTRA_DIST): Add ‘guix-gc.service.in’ and ‘guix-gc.timer’. * doc/guix.texi (Binary Installation): Mention the new systemd files. Signed-off-by: Mathieu Othacehe --- etc/guix-gc.service.in | 20 ++++++++++++++++++++ etc/guix-gc.timer | 15 +++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 etc/guix-gc.service.in create mode 100644 etc/guix-gc.timer (limited to 'etc') diff --git a/etc/guix-gc.service.in b/etc/guix-gc.service.in new file mode 100644 index 0000000000..2f1ca6584b --- /dev/null +++ b/etc/guix-gc.service.in @@ -0,0 +1,20 @@ +# This is a "service unit file" for the systemd init system to perform a +# one-shot 'guix gc' operation. It is meant to be triggered by a timer. +# Drop it in /etc/systemd/system or similar together with 'guix-gc.timer' +# to set it up. + +[Unit] +Description=Discard unused Guix store items + +[Service] +Type=oneshot +# Customize the 'guix gc' arguments to fit your needs. +ExecStart=@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix gc -d 1m -F 10G +PrivateDevices=yes +PrivateNetwork=yes +PrivateUsers=no +ProtectKernelTunables=yes +ProtectKernelModules=yes +ProtectControlGroups=yes +MemoryDenyWriteExecute=yes +SystemCallFilter=@default @file-system @basic-io @system-service diff --git a/etc/guix-gc.timer b/etc/guix-gc.timer new file mode 100644 index 0000000000..192132fbda --- /dev/null +++ b/etc/guix-gc.timer @@ -0,0 +1,15 @@ +# This is a "timer unit file" for the systemd init system to trigger +# 'guix-gc.service' periodically. Drop it in /etc/systemd/system or similar +# together with 'guix-gc.service' to set it up. + +[Unit] +Description=Discard unused Guix store items + +[Timer] +OnCalendar=weekly +AccuracySec=1h +Persistent=true +RandomizedDelaySec=6000 + +[Install] +WantedBy=timers.target -- cgit 1.4.1