nixpkgs/nixos/modules
Elias Probst 27da11972d nixos/restic: correct location of cache directory
By default, restic determines the location of the cache based on the XDG
base dir specification, which is `~/.cache/restic` when the environment
variable `$XDG_CACHE_HOME` isn't set.
As restic is executed as root by default, this resulted in the cache being
written to `/root/.cache/restic`, which is not quite right for a system
service and also meant, multiple backup services would use the same cache
directory - potentially causing issues with locking, data corruption,
etc.

The goal was to ensure, restic uses the correct cache location for a
system service - one cache per backup specification, using `/var/cache`
as the base directory for it.

systemd sets the environment variable `$CACHE_DIRECTORY` once
`CacheDirectory=` is defined, but restic doesn't change its behavior
based on the presence of this environment variable.
Instead, the specifier [1] `%C` can be used to point restic explicitly
towards the correct cache location using the `--cache-dir` argument.

Furthermore, the `CacheDirectoryMode=` was set to `0700`, as the default
of `0755` is far too open in this case, as the cache might contain
sensitive data.

[1] https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Specifiers
2021-01-30 18:24:51 -08:00
..
config treewide: fix double quoted strings in meta.description 2021-01-24 19:56:59 +07:00
hardware Merge pull request #108725 from veehaitch/ath_regd_optional 2021-01-30 14:07:25 +00:00
i18n/input-method fcitx5: update doc 2021-01-24 02:10:23 +01:00
installer lib: Clean up how linux and gcc config is specified 2021-01-23 10:01:28 -05:00
misc nixos/dysnomia nixos/disnix: Drop modules 2021-01-27 11:27:09 +01:00
profiles qemu-guest: remove security.rngd setting 2021-01-27 18:27:34 +01:00
programs Merge pull request #101796 from luc65r/pkg/tilp2 2021-01-25 01:11:50 +01:00
security Merge pull request #108819 from SuperSandro2000/nginx-module 2021-01-30 21:46:35 +01:00
services nixos/restic: correct location of cache directory 2021-01-30 18:24:51 -08:00
system Merge pull request #98858 from sorki/cross/rpifw 2021-01-29 10:21:32 -06:00
tasks Merge pull request #100155 from primeos/nixos-add-fqdn-option 2021-01-25 16:45:45 +01:00
testing nixos/tests: only apply qemu parameters if the options are defined 2020-10-25 13:42:01 +01:00
virtualisation nixos/oci-containers: Remove dep on system.path 2021-01-29 18:29:07 +01:00
module-list.nix Merge pull request #108725 from veehaitch/ath_regd_optional 2021-01-30 14:07:25 +00:00
rename.nix frab: remove package 2020-12-10 22:24:11 +01:00