modules: services: wireguard: simplify
This commit is contained in:
parent
49b2cb9781
commit
2f3989bba1
|
@ -8,16 +8,7 @@ let
|
|||
secrets = config.age.secrets;
|
||||
hostName = config.networking.hostName;
|
||||
|
||||
peers =
|
||||
let
|
||||
mkPeer = name: attrs: {
|
||||
inherit (attrs) clientNum publicKey;
|
||||
privateKeyFile = secrets."wireguard/private-key".path;
|
||||
} // lib.optionalAttrs (attrs ? externalIp) {
|
||||
inherit (attrs) externalIp;
|
||||
};
|
||||
in
|
||||
lib.mapAttrs mkPeer {
|
||||
peers = {
|
||||
# "Server"
|
||||
porthos = {
|
||||
clientNum = 1;
|
||||
|
@ -60,7 +51,7 @@ let
|
|||
"${v4.subnet}.${toString thisPeer.clientNum}/${toString v4.mask}"
|
||||
"${v6.subnet}::${toString thisPeer.clientNum}/${toHexString v6.mask}"
|
||||
];
|
||||
inherit (thisPeer) privateKeyFile;
|
||||
privateKeyFile = secrets."wireguard/private-key".path;
|
||||
|
||||
peers =
|
||||
let
|
||||
|
|
Loading…
Reference in a new issue