···
configFile = name: cfg: ''
cachedir ${config.services.tarsnap.cachedir}/${name}
10
-
keyfile ${config.services.tarsnap.keyfile}
10
+
keyfile ${cfg.keyfile}
${optionalString cfg.nodump "nodump"}
${optionalString cfg.printStats "print-stats"}
${optionalString cfg.printStats "humanize-numbers"}
···
Create the keyfile with <command>tarsnap-keygen</command>.
44
+
Note that each individual archive (specified below) may also have its
45
+
own individual keyfile specified. Tarsnap does not allow multiple
46
+
concurrent backups with the same cache directory and key (starting a
47
+
new backup will cause another one to fail). If you have multiple
48
+
archives specified, you should either spread out your backups to be
49
+
far apart, or specify a separate key for each archive. By default
50
+
every archive defaults to using
51
+
<literal>"/root/tarsnap.key"</literal>.
53
+
It's recommended for backups that you generate a key for every archive
54
+
using <literal>tarsnap-keygen(1)</literal>, and then generate a
55
+
write-only tarsnap key using <literal>tarsnap-keymgmt(1)</literal>,
56
+
and keep your master key(s) for a particular machine off-site.
The keyfile name should be given as a string and not a path, to
avoid the key being copied into the Nix store.
···
type = types.attrsOf (types.submodule (
88
+
keyfile = mkOption {
90
+
default = config.services.tarsnap.keyfile;
92
+
Set a specific keyfile for this archive. This defaults to
93
+
<literal>"/root/tarsnap.key"</literal> if left unspecified.
95
+
Use this option if you want to run multiple backups
96
+
concurrently - each archive must have a unique key. You can
97
+
generate a write-only key derived from your master key (which
98
+
is recommended) using <literal>tarsnap-keymgmt(1)</literal>.
100
+
Note: every archive must have an individual master key. You
101
+
must generate multiple keys with
102
+
<literal>tarsnap-keygen(1)</literal>, and then generate write
103
+
only keys from those.
105
+
The keyfile name should be given as a string and not a path, to
106
+
avoid the key being copied into the Nix store.