From afdf1fb1ffaa64400f7c72b66bc6d8865539244f Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 17 Dec 2017 14:33:23 +0100 Subject: =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom/borgbackup.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'custom') diff --git a/custom/borgbackup.nix b/custom/borgbackup.nix index e3e61c82..7da35b05 100644 --- a/custom/borgbackup.nix +++ b/custom/borgbackup.nix @@ -59,7 +59,7 @@ in { config = mkIf (any (t: t.paths != []) (attrValues cfg.targets)) { services.btrfs-snapshots.enable = mkIf (cfg.snapshots == "btrfs") true; - systemd.timers = listToAttrs (map ({ target, path, tCfg }: nameValuePair "borgbackup-${target}-${path}" { + systemd.timers = (listToAttrs (map ({ target, path, tCfg }: nameValuePair "borgbackup-${target}-${path}" { wantedBy = [ "timers.target" ]; timerConfig = { @@ -67,7 +67,7 @@ in { OnBootSec = tCfg.interval; OnUnitInactiveSec = tCfg.interval; }; - }) (flatten (mapAttrsToList (target: tCfg: map (path: { inherit target path tCfg; }) tCfg.paths) cfg.targets))) // mapAttrs (target: tCfg: nameValuePair "borgbackup-prune-${target}" { + }) (flatten (mapAttrsToList (target: tCfg: map (path: { inherit target path tCfg; }) tCfg.paths) cfg.targets)))) // (mapAttrs (target: tCfg: nameValuePair "borgbackup-prune-${target}" { wantedBy = [ "timers.target" ]; timerConfig = { @@ -75,9 +75,9 @@ in { OnBootSec = tCfg.interval; OnUnitInactiveSec = tCfg.interval; }; - }) cfg.targets; + }) cfg.targets); - systemd.services = mapAttrs (target: tCfg: nameValuePair "borgbackup-${target}@" (let + systemd.services = (mapAttrs (target: tCfg: nameValuePair "borgbackup-${target}@" (let deps = flatten [ (optional (cfg.snapshots == "btrfs") "btrfs-snapshot@%p.service") (optional tCfg.network "network-online.target") @@ -117,20 +117,20 @@ in { IOSchedulingPriority = 7; SuccessExitStatus = [1 2]; }; - })) cfg.targets // mapAttrs (target: tCfg: nameValuePair "borgbackup-prune-${target}" { + })) cfg.targets) // (mapAttrs (target: tCfg: nameValuePair "borgbackup-prune-${target}" { bindsTo = "network-online.target"; after = "network-online.target"; - script = concatStringsSep "\n" (mapAttrsToList ('' + script = concatStringsSep "\n" (mapAttrsToList (path: args: '' borg prune \ --prefix "${cfg.prefix}${path}" \ - ${concatStringsSep " " tCfg.prune."${path}"} \ + ${concatStringsSep " " args} \ ${tCfg.repo} '') tCfg.prune); serviceConfig = { Type = "oneshot"; }; - }) cfg.targets; + }) cfg.targets); }; } -- cgit v1.2.3