mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
etc: Add systemd files for running ‘guix gc’ periodically
* 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 <othacehe@gnu.org>
This commit is contained in:
parent
cbb76da1f6
commit
5c4fd77097
5 changed files with 53 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -74,6 +74,7 @@
|
|||
/etc/guix-daemon.service
|
||||
/etc/guix-publish.conf
|
||||
/etc/guix-publish.service
|
||||
/etc/guix-gc.service
|
||||
/etc/init.d/guix-daemon
|
||||
/etc/openrc/guix-daemon
|
||||
/guix-*
|
||||
|
|
|
@ -743,6 +743,18 @@ with these commands:
|
|||
# systemctl enable --now gnu-store.mount guix-daemon
|
||||
@end example
|
||||
|
||||
You may also want to arrange for @command{guix gc} to run periodically:
|
||||
|
||||
@example
|
||||
# cp ~root/.config/guix/current/lib/systemd/system/guix-gc.service \
|
||||
~root/.config/guix/current/lib/systemd/system/guix-gc.timer \
|
||||
/etc/systemd/system/
|
||||
# systemctl enable --now guix-gc.timer
|
||||
@end example
|
||||
|
||||
You may want to edit @file{guix-gc.service} to adjust the command line
|
||||
options to fit your needs (@pxref{Invoking guix gc}).
|
||||
|
||||
If your host distro uses the Upstart init system:
|
||||
|
||||
@example
|
||||
|
|
20
etc/guix-gc.service.in
Normal file
20
etc/guix-gc.service.in
Normal file
|
@ -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
|
15
etc/guix-gc.timer
Normal file
15
etc/guix-gc.timer
Normal file
|
@ -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
|
|
@ -153,7 +153,9 @@ systemdservicedir = $(libdir)/systemd/system
|
|||
nodist_systemdservice_DATA = \
|
||||
etc/gnu-store.mount \
|
||||
etc/guix-daemon.service \
|
||||
etc/guix-publish.service
|
||||
etc/guix-publish.service \
|
||||
etc/guix-gc.service \
|
||||
etc/guix-gc.timer
|
||||
|
||||
etc/%.mount: etc/%.mount.in \
|
||||
$(top_builddir)/config.status
|
||||
|
@ -216,6 +218,8 @@ EXTRA_DIST += \
|
|||
etc/guix-daemon.conf.in \
|
||||
etc/guix-publish.service.in \
|
||||
etc/guix-publish.conf.in \
|
||||
etc/guix-gc.service.in \
|
||||
etc/guix-gc.timer \
|
||||
etc/init.d/guix-daemon.in \
|
||||
etc/openrc/guix-daemon.in
|
||||
|
||||
|
|
Loading…
Reference in a new issue