summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2021-01-23 17:34:59 +0100
committerlassulus <lassulus@lassul.us>2021-01-23 17:34:59 +0100
commit859a6d1e732bfc40e65f5ed7b33d4014d77740a8 (patch)
tree3c441be141727e377035ddf2525827e40ba3070c
parente95b720d97c0723f9ae7d72ae76788e2d8130d30 (diff)
l bindfs: add clearTarget option
-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}'
'';