{
  lib,
  config,
  ...
}: let
  cfg = config.marleyos.mounts.babeshare;

  user = config.users.users."${config.marleyos.my.name}";
  uid =
    if user.uid != null
    then user.uid
    else 1000;

  options = lib.concatStringsSep "," [
    "username=marley"
    "password=granola chaos lend splendid"
    "uid=${toString uid}"
    "gid=${toString config.users.groups."wheel".gid}"
    "nofail"
  ];
in {
  options.marleyos.mounts.babeshare.enable = lib.mkEnableOption "babeshare";

  config = lib.mkIf cfg.enable {
    boot.supportedFilesystems = {
      cifs = true;
    };

    systemd = {
      mounts = [
        {
          what = "//truenas.blackcat.vip/babez";
          where = "/mnt/babeshare/babez";
          type = "cifs";
          inherit options;
        }
        {
          what = "//truenas.blackcat.vip/marley";
          where = "/mnt/babeshare/marley";
          type = "cifs";
          inherit options;
        }
      ];
      automounts = [
        {
          where = "/mnt/babeshare/babez";
          wantedBy = ["multi-user.target"];
        }
        {
          where = "/mnt/babeshare/marley";
          wantedBy = ["multi-user.target"];
        }
      ];
    };
  };
}
