summaryrefslogtreecommitdiff
path: root/custom/lvm-snapshots.nix
diff options
context:
space:
mode:
Diffstat (limited to 'custom/lvm-snapshots.nix')
-rw-r--r--custom/lvm-snapshots.nix8
1 files changed, 3 insertions, 5 deletions
diff --git a/custom/lvm-snapshots.nix b/custom/lvm-snapshots.nix
index c78de3a5..5e4557f3 100644
--- a/custom/lvm-snapshots.nix
+++ b/custom/lvm-snapshots.nix
@@ -9,8 +9,6 @@ let
9 snapshotMount = name: "${cfg.mountPoint}/${if isNull cfg.snapshots."${name}".mountName then name else cfg.snapshots."${name}".mountName}"; 9 snapshotMount = name: "${cfg.mountPoint}/${if isNull cfg.snapshots."${name}".mountName then name else cfg.snapshots."${name}".mountName}";
10 snapshotName = name: "${name}-snapshot"; 10 snapshotName = name: "${name}-snapshot";
11 11
12 instance = scfg: escapeSystemdPath (scfg.VG + "/" + scfg.LV);
13
14 snapshotConfig = { 12 snapshotConfig = {
15 options = { 13 options = {
16 LV = mkOption { 14 LV = mkOption {
@@ -67,7 +65,7 @@ in {
67 mkdir -p ${snapshotMount name} 65 mkdir -p ${snapshotMount name}
68 '') cfg.snapshots; 66 '') cfg.snapshots;
69 67
70 systemd.services = mapAttrs' (name: scfg: nameValuePair ("lvm-snapshot@" + instance scfg) { 68 systemd.services = mapAttrs' (name: scfg: nameValuePair ("lvm-snapshot@" + escapeSystemdPath name) {
71 enable = true; 69 enable = true;
72 70
73 description = "LVM-snapshot of ${scfg.VG}/${scfg.LV}"; 71 description = "LVM-snapshot of ${scfg.VG}/${scfg.LV}";
@@ -111,8 +109,8 @@ in {
111 StopWhenUnneeded = !scfg.persist; 109 StopWhenUnneeded = !scfg.persist;
112 }; 110 };
113 111
114 bindsTo = [ ("lvm-snapshot@" + instance scfg + ".service") ]; 112 bindsTo = [ ("lvm-snapshot@" + escapeSystemdPath name + ".service") ];
115 after = [ ("lvm-snapshot@" + instance scfg + ".service") ]; 113 after = [ ("lvm-snapshot@" + escapeSystemdPath name + ".service") ];
116 114
117 options = concatStringsSep "," ([ "noauto" ] ++ optional scfg.readOnly "ro"); 115 options = concatStringsSep "," ([ "noauto" ] ++ optional scfg.readOnly "ro");
118 116