{ config, lib, pkgs, ... }:

{
  # Block storage mount
  fileSystems."/srv/sealight" = {
    device = "/dev/disk/by-id/virtio-mel-3b1f60a89cd649";
    fsType = "ext4";
    options = [ "noatime" ];
  };

  # Bind mounts for service data
  # PostgreSQL moved to NVMe for performance - data lives directly on /var/lib/postgresql
  # fileSystems."/var/lib/postgresql" = {
  #   device = "/srv/sealight/postgresql";
  #   fsType = "none";
  #   options = [ "bind" "x-systemd.requires-mounts-for=/srv/sealight" ];
  # };

  fileSystems."/var/lib/matrix-synapse" = {
    device = "/srv/sealight/matrix-synapse";
    fsType = "none";
    options = [ "bind" "x-systemd.requires-mounts-for=/srv/sealight" ];
  };

  fileSystems."/var/lib/matrix-as-discord" = {
    device = "/srv/sealight/matrix-as-discord";
    fsType = "none";
    options = [ "bind" "x-systemd.requires-mounts-for=/srv/sealight" ];
  };

  fileSystems."/var/lib/mautrix-telegram" = {
    device = "/srv/sealight/mautrix-telegram";
    fsType = "none";
    options = [ "bind" "x-systemd.requires-mounts-for=/srv/sealight" ];
  };

  fileSystems."/var/lib/wireguard" = {
    device = "/srv/sealight/wireguard";
    fsType = "none";
    options = [ "bind" "x-systemd.requires-mounts-for=/srv/sealight" ];
  };

  fileSystems."/var/www" = {
    device = "/srv/sealight/www";
    fsType = "none";
    options = [ "bind" "x-systemd.requires-mounts-for=/srv/sealight" ];
  };

  # Ensure services wait for mounts
  # PostgreSQL no longer needs to wait for /srv/sealight mount
  # systemd.services.postgresql.unitConfig.RequiresMountsFor = [ "/srv/sealight" ];
  systemd.services.matrix-synapse.unitConfig.RequiresMountsFor = [ "/srv/sealight" ];
}
