From 7c3d67bb98d31f433bb3ab7a2c05c0808c8deac5 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 14 Apr 2018 17:20:32 +0200 Subject: systemd escaping --- custom/lvm-snapshots.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/custom/lvm-snapshots.nix b/custom/lvm-snapshots.nix index 86b3061a..c78de3a5 100644 --- a/custom/lvm-snapshots.nix +++ b/custom/lvm-snapshots.nix @@ -9,6 +9,8 @@ let snapshotMount = name: "${cfg.mountPoint}/${if isNull cfg.snapshots."${name}".mountName then name else cfg.snapshots."${name}".mountName}"; snapshotName = name: "${name}-snapshot"; + instance = scfg: escapeSystemdPath (scfg.VG + "/" + scfg.LV); + snapshotConfig = { options = { LV = mkOption { @@ -65,7 +67,7 @@ in { mkdir -p ${snapshotMount name} '') cfg.snapshots; - systemd.services = mapAttrs' (name: scfg: nameValuePair ("lvm-snapshot@" + scfg.VG + "-" + snapshotName name) { + systemd.services = mapAttrs' (name: scfg: nameValuePair ("lvm-snapshot@" + instance scfg) { enable = true; description = "LVM-snapshot of ${scfg.VG}/${scfg.LV}"; @@ -109,8 +111,8 @@ in { StopWhenUnneeded = !scfg.persist; }; - bindsTo = [ ("lvm-snapshot@" + scfg.VG + "-" + snapshotName name + ".service") ]; - after = [ ("lvm-snapshot@" + scfg.VG + "-" + snapshotName name + ".service") ]; + bindsTo = [ ("lvm-snapshot@" + instance scfg + ".service") ]; + after = [ ("lvm-snapshot@" + instance scfg + ".service") ]; options = concatStringsSep "," ([ "noauto" ] ++ optional scfg.readOnly "ro"); -- cgit v1.2.3