{ config, ... }: let plex = config.modules.mounts.plex; kioku = config.modules.mounts.usb; in { fileSystems = { "/mnt/${kioku.name}" = let sharedOptions = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=60" "x-systemd.device-timeout=5s" "x-systemd.mount-timeout=5s" "rw" "nofail" "noatime" "uid=1000" "gid=1000" ]; in if kioku.withSamba then { device = "//${kioku.name}/${kioku.shareName}"; fsType = "cifs"; options = [ "credentials=${config.sops.secrets.samba_secrets.path}" ] ++ sharedOptions ++ kioku.extraOptions; } else { device = kioku.device; fsType = "exfat"; options = sharedOptions; }; } // ( if plex.enable then { "/mnt/${plex.name}" = { device = "/dev/mapper/${plex.name}"; fsType = "exfat"; options = [ "rw" "nofail" "uid=1000" "gid=1000" "dmask=027" "fmask=137" ] ++ plex.extraOptions; }; } else { } ); environment.etc.crypttab.text = if plex.enable then '' ${plex.name} /dev/disk/by-partlabel/WD_BLACK ${config.sops.secrets.plex_drive_bitlocker_recovery_key.path} bitlk '' else ""; }