system/wireguard: fix caramel and client config
This commit is contained in:
parent
f774334203
commit
c4e2846818
2 changed files with 5 additions and 3 deletions
|
|
@ -6,6 +6,7 @@
|
|||
age.secrets = {
|
||||
passwd.file = ../../secrets/passwd.age;
|
||||
wpa_conf.file = ../../secrets/wpa_conf.age;
|
||||
wg_caramel.file = ../../secrets/wg_caramel.age;
|
||||
};
|
||||
imports = with modules.system; [
|
||||
inputs.home-manager-porcupine.nixosModule
|
||||
|
|
|
|||
|
|
@ -74,9 +74,10 @@ let
|
|||
clientConfig = {
|
||||
wireguard.interfaces.wg0 =
|
||||
let
|
||||
client = routeBypass."${config.networking.hostName}";
|
||||
mappedAdd = lib.concatMapStringsSep "\n" (r: "${pkgs.iproute2}/bin/ip route add ${r} via ${client.gateway} dev ${client.interface}") client.routes;
|
||||
mappedDel = lib.concatMapStringsSep "\n" (r: "${pkgs.iproute2}/bin/ip route del ${r} via ${client.gateway} dev ${client.interface}") client.routes;
|
||||
client = clients."${config.networking.hostName}";
|
||||
routes = routeBypass."${config.networking.hostName}";
|
||||
mappedAdd = lib.concatMapStringsSep "\n" (r: "${pkgs.iproute2}/bin/ip route add ${r} via ${routes.gateway} dev ${routes.interface}") routes.routes;
|
||||
mappedDel = lib.concatMapStringsSep "\n" (r: "${pkgs.iproute2}/bin/ip route del ${r} via ${routes.gateway} dev ${routes.interface}") routes.routes;
|
||||
in {
|
||||
ips = client.allowedIPs;
|
||||
listenPort = port;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue