{ lib, config, ... }:
{
  options.system.wireguard.client.enable = lib.mkOption {
    type = lib.types.bool;
    default = false;
  };

  config = lib.mkIf config.system.wireguard.client.enable {
    networking = {
      firewall.trustedInterfaces = [ "wgc" ];
      wg-quick.interfaces.wgc = {
        privateKey = config.secrets.wgClientPriv;
        peers = [
          { # Cyberspark Server
            publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8=";
            allowedIPs = [ "10.100.0.0/24" ];
            endpoint = "sv.${config.domains.p1}:51820";
            persistentKeepalive = 25;
          }
        ];
      };
    };
  };
}
