summaryrefslogtreecommitdiffstats
path: root/lass/3modules/bindfs.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lass/3modules/bindfs.nix')
-rw-r--r--lass/3modules/bindfs.nix61
1 files changed, 0 insertions, 61 deletions
diff --git a/lass/3modules/bindfs.nix b/lass/3modules/bindfs.nix
deleted file mode 100644
index c489ef163..000000000
--- a/lass/3modules/bindfs.nix
+++ /dev/null
@@ -1,61 +0,0 @@
-with import <stockholm/lib>;
-{ config, pkgs, ... }:
-let
- cfg = config.lass.bindfs;
-in {
- options.lass.bindfs = mkOption {
- type = types.attrsOf (types.submodule ({ config, ... }: {
- options = {
- target = mkOption {
- description = ''
- destination where bindfs mounts to.
- second positional argument to bindfs.
- '';
- default = config._module.args.name;
- type = types.absolute-pathname;
- };
- source = mkOption {
- description = ''
- source folder where the mounted directory is originally.
- first positional argument to bindfs.
- '';
- type = types.absolute-pathname;
- };
- options = mkOption {
- description = ''
- additional arguments to bindfs
- '';
- type = types.listOf types.str;
- default = [];
- };
- clearTarget = mkOption {
- description = ''
- whether to clear the target folder before mounting
- '';
- type = types.bool;
- default = false;
- };
- };
- }));
- default = {};
- };
-
- config = mkIf (cfg != {}) {
- systemd.services = mapAttrs' (n: mount: let
- name = replaceStrings [ "/" ] [ "_" ] n;
- in nameValuePair "bindfs-${name}" {
- wantedBy = [ "local-fs.target" ];
- 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}'
- '';
- ExecStart = "${pkgs.bindfs}/bin/bindfs -f ${concatStringsSep " " mount.options} ${mount.source} ${mount.target}";
- };
- }) cfg;
- };
-}