System Gen165 @ 2025-04-23-23:50:24
This commit is contained in:
@@ -8,6 +8,11 @@
|
||||
in {
|
||||
options.networking.wg.client = {
|
||||
enable = lib.mkEnableOption "Enable WireGuard client";
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 51820;
|
||||
description = "Port for WireGuard client";
|
||||
};
|
||||
autoConnect = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
@@ -20,17 +25,15 @@ in {
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
networking.wg-quick.interfaces.wg0 = {
|
||||
inherit (peers.jonas) address;
|
||||
networking.firewall.allowedUDPPorts = [cfg.port];
|
||||
networking.wireguard.interfaces.wg0 = {
|
||||
inherit (peers.jonas) ips;
|
||||
inherit (cfg) privateKeyFile;
|
||||
listenPort = cfg.port;
|
||||
|
||||
peers = [
|
||||
peers.harbor
|
||||
];
|
||||
};
|
||||
systemd.services.wg-quick-wg0.wantedBy =
|
||||
if cfg.autoConnect
|
||||
then lib.mkDefault []
|
||||
else lib.mkForce [];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user