{ config, lib, ... }: let cfg = config.networking.wg.client; peers = import ./peers.nix {}; in { options.networking.wg.client = { enable = lib.mkEnableOption "Enable WireGuard client"; autoConnect = lib.mkOption { type = lib.types.bool; default = false; description = "Automatically connect to the WireGuard server with systemd"; }; privateKeyFile = lib.mkOption { type = lib.types.path; description = "Path to the private key file for the WireGuard client"; }; }; config = lib.mkIf cfg.enable { networking.wg-quick.interfaces.wg0 = { inherit (peers.jonas) address; inherit (cfg) privateKeyFile; autostart = cfg.autoConnect; peers = [ peers.harbor ]; }; }; }