git.iko.soy/typeable/nixpkgs
on master help sign in
Add support for tarsnap options -H and -L

A new option `explicitSymlinks` will set `-H` when creating an archive. This option makes tarsnap follow any symlinks specified explicitly on the commandline, but not any found inside the file tree. A new option `followSymlinks` will set `-L` when creating an archive. This option makes tarsnap follow any symlinks found anywhere in the file tree instead of storing them as-is.

commitd46259560030851e9a0ea73375779b9bf56e3b92 authorMichishige Kaito <me@mkaito.com> dateMon 26 Mar 2018, 12:39 (9 years ago) parentadaa9d9
1 file changed+16
nixos/modules/services/backup/tarsnap.nix+16
nixos/modules/services/backup/tarsnap.nix+16
@@ -238,6 +238,20 @@ in
238238 Whether to produce verbose logging output.
239239 '';
240240 };
241+ explicitSymlinks = mkOption {
242+ type = types.bool;
243+ default = false;
244+ description = ''
245+ Whether to follow symlinks specified as archives.
246+ '';
247+ };
248+ followSymlinks = mkOption {
249+ type = types.bool;
250+ default = false;
251+ description = ''
252+ Whether to follow all symlinks in archive trees.
253+ '';
254+ };
241255 };
242256 }
243257 ));
@@ -304,6 +318,8 @@ in
304318 let run = ''tarsnap --configfile "/etc/tarsnap/${name}.conf" \
305319 -c -f "${name}-$(date +"%Y%m%d%H%M%S")" \
306320 ${optionalString cfg.verbose "-v"} \
321+ ${optionalString cfg.explicitSymlinks "-H"} \
322+ ${optionalString cfg.followSymlinks "-L"} \
307323 ${concatStringsSep " " cfg.directories}'';
308324 in if (cfg.cachedir != null) then ''
309325 mkdir -p ${cfg.cachedir}