diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2018-04-09 14:57:30 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2018-04-09 14:57:30 +0200 |
commit | 215ab1596bc5adfc16789844e2e9d3b27cc698c0 (patch) | |
tree | 101942b6dddf1bf84157888d5669bdcb313524e6 /custom/borgbackup.nix | |
parent | 785f142fdc12c81aad25f393ae0cc8436d41f65c (diff) | |
download | nixos-215ab1596bc5adfc16789844e2e9d3b27cc698c0.tar nixos-215ab1596bc5adfc16789844e2e9d3b27cc698c0.tar.gz nixos-215ab1596bc5adfc16789844e2e9d3b27cc698c0.tar.bz2 nixos-215ab1596bc5adfc16789844e2e9d3b27cc698c0.tar.xz nixos-215ab1596bc5adfc16789844e2e9d3b27cc698c0.zip |
cleanup
Diffstat (limited to 'custom/borgbackup.nix')
-rw-r--r-- | custom/borgbackup.nix | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/custom/borgbackup.nix b/custom/borgbackup.nix index fe380695..ab826757 100644 --- a/custom/borgbackup.nix +++ b/custom/borgbackup.nix | |||
@@ -21,6 +21,10 @@ let | |||
21 | 21 | ||
22 | systemdPath = path: if cfg.snapshots == "lvm" then escapeSystemdPath "${path.VG}/${path.LV}" else escapeSystemdPath path; | 22 | systemdPath = path: if cfg.snapshots == "lvm" then escapeSystemdPath "${path.VG}/${path.LV}" else escapeSystemdPath path; |
23 | 23 | ||
24 | withPrefix = path: config.services.btrfs-snapshots.mountPrefix + path; | ||
25 | |||
26 | mountPoint = if cfg.snapshots == "lvm" then config.services.lvm-snapshots.mountPoint else config.services.btrfs-snapshots.mountPoint; | ||
27 | |||
24 | targetOptions = { | 28 | targetOptions = { |
25 | options = { | 29 | options = { |
26 | repo = mkOption { | 30 | repo = mkOption { |
@@ -88,7 +92,7 @@ in { | |||
88 | 92 | ||
89 | services.lvm-snapshots.snapshots = mkIf (cfg.snapshots == "lvm") (listToAttrs (map (path: nameValuePair (escapeSystemdPath path.LV) { | 93 | services.lvm-snapshots.snapshots = mkIf (cfg.snapshots == "lvm") (listToAttrs (map (path: nameValuePair (escapeSystemdPath path.LV) { |
90 | inherit (path) LV VG; | 94 | inherit (path) LV VG; |
91 | mountName = "snapshot-${systemdPath path}"; | 95 | mountName = withPrefix (systemdPath path); |
92 | }) (unique (flatten (mapAttrsToList (target: tCfg: tCfg.paths) cfg.targets))))); | 96 | }) (unique (flatten (mapAttrsToList (target: tCfg: tCfg.paths) cfg.targets))))); |
93 | 97 | ||
94 | systemd.timers = (listToAttrs (map ({ target, path, tCfg }: nameValuePair "borgbackup-${target}@${systemdPath path}" { | 98 | systemd.timers = (listToAttrs (map ({ target, path, tCfg }: nameValuePair "borgbackup-${target}@${systemdPath path}" { |
@@ -143,7 +147,7 @@ in { | |||
143 | 147 | ||
144 | serviceConfig = { | 148 | serviceConfig = { |
145 | Type = "oneshot"; | 149 | Type = "oneshot"; |
146 | WorkingDirectory = if (cfg.snapshots == null) then "%p" else "/mnt/snapshot-%i"; | 150 | WorkingDirectory = if (cfg.snapshots == null) then "%p" else "${mountPoint}/${withPrefix "%i"}"; |
147 | Nice = 15; | 151 | Nice = 15; |
148 | IOSchedulingClass = 2; | 152 | IOSchedulingClass = 2; |
149 | IOSchedulingPriority = 7; | 153 | IOSchedulingPriority = 7; |