l bindfs: add clearTarget option

This commit is contained in:
lassulus 2021-01-23 17:34:59 +01:00
parent e95b720d97
commit 859a6d1e73

View File

@ -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}'
'';