From 859a6d1e732bfc40e65f5ed7b33d4014d77740a8 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 23 Jan 2021 17:34:59 +0100 Subject: l bindfs: add clearTarget option --- lass/3modules/bindfs.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) 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}' ''; -- cgit v1.2.3