{ config, pkgs, ... }:
{
    services.adguardhome = {
        enable = true;
    };

    services.nginx = {
        enable = true;
        virtualHosts = {
            "ad.guard" = {
              listenAddresses = [ "0.0.0.0" "[::]" ];
                locations."/" = {
                    proxyPass = "http://localhost:5380";
                };
            };
        };
    };

    networking.firewall.allowedUDPPorts = [ 53 67 68 ];

    # Capabilities for DHCP server
    systemd.services.adguardhome.serviceConfig.AmbientCapabilities = [ "CAP_NET_RAW" ];

    systemd.services."adguardhome" = {
        # requires = ["dhcpcd.service"];
        after = ["dhcpcd.service"];
    };
}
