aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2018-07-31 22:17:39 +0200
committerlassulus <lassulus@lassul.us>2018-07-31 22:17:39 +0200
commit107a37f52740bfa6ae8378efae4391fdbc7039cf (patch)
treea48720a1c59e84ea2a4ea9f43c7f21af6f896625 /lib
parent348d4f164ffc506d1cb8e58864e345ce978e3a50 (diff)
lib.mount.filesystem: don't mount if already mounted
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/default.nix b/lib/default.nix
index c6234e0..54bcf24 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -82,8 +82,10 @@ let {
mount.filesystem = q: x: {
fs.${x.mountpoint} = ''
- mkdir -p ${x.mountpoint}
- mount ${q.device} ${x.mountpoint}
+ if ! [ "$(mount | sed -n 's:\([^ ]\+\) on ${x.mountpoint} .*:\1:p')" = ${q.device} ]; then
+ mkdir -p ${x.mountpoint}
+ mount ${q.device} ${x.mountpoint}
+ fi
'';
};