summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMichishige Kaito <me@mkaito.com>2018-03-26 12:39:00 +0100
committerMichishige Kaito <me@mkaito.com>2018-03-27 01:19:02 +0100
commitd46259560030851e9a0ea73375779b9bf56e3b92 (patch)
treefc6866035c703ef7beba4e45b880712815427004 /nixos
parentadaa9d93488c7fc1fee020899cb08ce2f899c94b (diff)
downloadnixpkgs-d46259560030851e9a0ea73375779b9bf56e3b92.tar
nixpkgs-d46259560030851e9a0ea73375779b9bf56e3b92.tar.gz
nixpkgs-d46259560030851e9a0ea73375779b9bf56e3b92.tar.bz2
nixpkgs-d46259560030851e9a0ea73375779b9bf56e3b92.tar.lz
nixpkgs-d46259560030851e9a0ea73375779b9bf56e3b92.tar.xz
nixpkgs-d46259560030851e9a0ea73375779b9bf56e3b92.tar.zst
nixpkgs-d46259560030851e9a0ea73375779b9bf56e3b92.zip
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.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/backup/tarsnap.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/nixos/modules/services/backup/tarsnap.nix b/nixos/modules/services/backup/tarsnap.nix
index 59e9d122fb5..c33aeb76cb0 100644
--- a/nixos/modules/services/backup/tarsnap.nix
+++ b/nixos/modules/services/backup/tarsnap.nix
@@ -238,6 +238,20 @@ in
                   Whether to produce verbose logging output.
                 '';
               };
+              explicitSymlinks = mkOption {
+                type = types.bool;
+                default = false;
+                description = ''
+                  Whether to follow symlinks specified as archives.
+                '';
+              };
+              followSymlinks = mkOption {
+                type = types.bool;
+                default = false;
+                description = ''
+                  Whether to follow all symlinks in archive trees.
+                '';
+              };
             };
           }
         ));
@@ -304,6 +318,8 @@ in
           let run = ''tarsnap --configfile "/etc/tarsnap/${name}.conf" \
                         -c -f "${name}-$(date +"%Y%m%d%H%M%S")" \
                         ${optionalString cfg.verbose "-v"} \
+                        ${optionalString cfg.explicitSymlinks "-H"} \
+                        ${optionalString cfg.followSymlinks "-L"} \
                         ${concatStringsSep " " cfg.directories}'';
           in if (cfg.cachedir != null) then ''
             mkdir -p ${cfg.cachedir}