{
  lib,
  config,
  pkgs,
  ...
}:
let
  cfg = config.mounts;
in
{
  options = {
    mounts = {
      enable = lib.mkEnableOption "Enable mounts in NixOS";
    };
  };
  config = lib.mkIf cfg.enable {
    environment.systemPackages = with pkgs; [
      cifs-utils
      nfs-utils
    ];
    fileSystems = builtins.listToAttrs (
      builtins.map
        (mount: {
          name = "/media/${mount.name}";
          value = {
            device = "media.home:/volume1/${mount.path}";
            fsType = "nfs";
            options = [
              # "x-systemd.automount"
              # "noauto"
              "x-systemd.idle-timeout=600"
              "rw"
            ];
          };
        })
        [
          {
            name = "archive";
            path = "documents/documents/archive";
          }
          {
            name = "photos";
            path = "photos";
          }
          {
            name = "video";
            path = "video";
          }
          {
            name = "audio";
            path = "audio";
          }
          {
            name = "home";
            path = "homes/ryan";
          }
          {
            name = "fileshare";
            path = "fileshare";
          }
        ]
    );
    services.rpcbind.enable = lib.mkForce true;
  };
}
