Commit graph

15 commits

Author SHA1 Message Date
Matt McHenry 13bee29b9b restic: allow prune without backup
fixes #97820
2021-03-21 18:47:52 -07:00
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
Jörg Thalheim ba930d8679
nixos/modules: remove trailing whitespace
This leads to ci failure otherwise if the file gets changed.
git-blame can ignore whitespace changes.
2020-08-07 14:45:39 +01:00
Imran Hossain 7dd656a037 nixos/restic: Add options for rclone repositories 2020-07-06 10:27:55 -04:00
Matt McHenry 5ad71cfe84
fix pruneCmd to use optionals so multi-element list is preserved 2020-02-07 10:25:33 +00:00
Jörg Thalheim 4fa2d4b5c3
nixos/restic: use optionalString/optionalAttrs where possible 2020-01-30 17:07:21 +00:00
Matt McHenry 1c9684abd6
restic: add dynamicFilesFrom 2020-01-30 17:00:10 +00:00
Matt McHenry c6994e90dc
restic: add support for pruning 2020-01-30 16:59:34 +00:00
LeOtaku 63ed962e4b nixos/restic: change type of timerConfig option to attrsOf unitOption
This is needed for correctly passing the option to "systemd.timer"
2019-01-23 21:29:02 +01:00
Matthew Bauer eb1afe452a
Merge pull request #44332 from jerith666/restic-s3-default
restic: add missing default for s3CredentialsFile
2018-08-01 22:56:12 -04:00
Matt McHenry 016922f88b restic: add missing default for s3CredentialsFile 2018-08-01 22:53:14 -04:00
volth 2e979e8ceb [bot] nixos/*: remove unused arguments in lambdas 2018-07-20 20:56:59 +00:00
volth 87f5930c3f [bot]: remove unreferenced code 2018-07-20 18:48:37 +00:00
Matt McHenry c61aad6574 restic: add s3CredentialsFile option 2018-06-02 14:12:23 -04:00
Lassulus 6db2057f00 nixos/restic: init (#38948) 2018-04-21 11:12:43 +01:00