nixpkgs/nixos
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
..
doc nixos/restic: correct location of cache directory 2021-01-30 18:24:51 -08:00
lib Merge pull request #67493 from clefru/make-disk-image 2021-01-29 07:18:50 +00:00
maintainers amazonImage: Upload disks as GP3 for cheaper & faster IO (#109027) 2021-01-11 13:54:40 -05:00
modules nixos/restic: correct location of cache directory 2021-01-30 18:24:51 -08:00
tests Merge pull request #109035 from turion/dev_nextcloud_php 2021-01-30 02:41:13 +01:00
COPYING
default.nix nixos: fix "nixos-rebuild build-vm-with-bootloader" for EFI systems 2021-01-08 19:36:10 +01:00
README treewide: use https for nixos.org and hydra.nixos.org 2020-05-03 22:14:21 -07:00
release-combined.nix Revert "release-combined.tested: Temporarily remove the Chromium test" 2021-01-24 15:27:49 +01:00
release-small.nix Merge pull request #104322 from grahamc/amazon-image 2020-11-19 18:45:07 -05:00
release.nix lib: Clean up how linux and gcc config is specified 2021-01-23 10:01:28 -05:00

*** NixOS ***

NixOS is a Linux distribution based on the purely functional package
management system Nix.  More information can be found at
https://nixos.org/nixos and in the manual in doc/manual.