summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lass/3modules/bindfs.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/lass/3modules/bindfs.nix b/lass/3modules/bindfs.nix
index 5c8df8dc5..c489ef163 100644
--- a/lass/3modules/bindfs.nix
+++ b/lass/3modules/bindfs.nix
@@ -28,6 +28,13 @@ in {
type = types.listOf types.str;
default = [];
};
+ clearTarget = mkOption {
+ description = ''
+ whether to clear the target folder before mounting
+ '';
+ type = types.bool;
+ default = false;
+ };
};
}));
default = {};
@@ -41,6 +48,9 @@ in {
path = [ pkgs.coreutils ];
serviceConfig = {
ExecStartPre = pkgs.writeDash "bindfs-init-${name}" ''
+ ${optionalString mount.clearTarget ''
+ rm -rf '${mount.target}'
+ ''}
mkdir -p '${mount.source}'
mkdir -p '${mount.target}'
'';