diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2018-04-14 17:20:32 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2018-04-14 17:20:32 +0200 |
commit | 7c3d67bb98d31f433bb3ab7a2c05c0808c8deac5 (patch) | |
tree | a224630b42f0df73a56ae4410c582d83779625e8 /custom | |
parent | c5696346983e54c53f14b525129f8f3af9817035 (diff) | |
download | nixos-7c3d67bb98d31f433bb3ab7a2c05c0808c8deac5.tar nixos-7c3d67bb98d31f433bb3ab7a2c05c0808c8deac5.tar.gz nixos-7c3d67bb98d31f433bb3ab7a2c05c0808c8deac5.tar.bz2 nixos-7c3d67bb98d31f433bb3ab7a2c05c0808c8deac5.tar.xz nixos-7c3d67bb98d31f433bb3ab7a2c05c0808c8deac5.zip |
systemd escaping
Diffstat (limited to 'custom')
-rw-r--r-- | custom/lvm-snapshots.nix | 8 |
1 files 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 | |||
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 | |||
12 | snapshotConfig = { | 14 | snapshotConfig = { |
13 | options = { | 15 | options = { |
14 | LV = mkOption { | 16 | LV = mkOption { |
@@ -65,7 +67,7 @@ in { | |||
65 | mkdir -p ${snapshotMount name} | 67 | mkdir -p ${snapshotMount name} |
66 | '') cfg.snapshots; | 68 | '') cfg.snapshots; |
67 | 69 | ||
68 | systemd.services = mapAttrs' (name: scfg: nameValuePair ("lvm-snapshot@" + scfg.VG + "-" + snapshotName name) { | 70 | systemd.services = mapAttrs' (name: scfg: nameValuePair ("lvm-snapshot@" + instance scfg) { |
69 | enable = true; | 71 | enable = true; |
70 | 72 | ||
71 | description = "LVM-snapshot of ${scfg.VG}/${scfg.LV}"; | 73 | description = "LVM-snapshot of ${scfg.VG}/${scfg.LV}"; |
@@ -109,8 +111,8 @@ in { | |||
109 | StopWhenUnneeded = !scfg.persist; | 111 | StopWhenUnneeded = !scfg.persist; |
110 | }; | 112 | }; |
111 | 113 | ||
112 | bindsTo = [ ("lvm-snapshot@" + scfg.VG + "-" + snapshotName name + ".service") ]; | 114 | bindsTo = [ ("lvm-snapshot@" + instance scfg + ".service") ]; |
113 | after = [ ("lvm-snapshot@" + scfg.VG + "-" + snapshotName name + ".service") ]; | 115 | after = [ ("lvm-snapshot@" + instance scfg + ".service") ]; |
114 | 116 | ||
115 | options = concatStringsSep "," ([ "noauto" ] ++ optional scfg.readOnly "ro"); | 117 | options = concatStringsSep "," ([ "noauto" ] ++ optional scfg.readOnly "ro"); |
116 | 118 | ||