aboutsummaryrefslogtreecommitdiff
path: root/nix/private-wireguard.nix
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-06-10 11:42:32 -0700
committerFranck Cuny <franck@fcuny.net>2022-06-10 13:12:35 -0700
commit98e01cdbfa047a32c1beb73438c5b93ca0592978 (patch)
tree403b462f1b6d6e4432c010e8f47e179e3e730a97 /nix/private-wireguard.nix
parentdocs(gerrit): document various things (diff)
downloadinfra-98e01cdbfa047a32c1beb73438c5b93ca0592978.tar.gz
fix(fmt): correct formatting for all nix files
This was done by running `nixpkgs-fmt .'. Change-Id: I4ea6c1e759bf468d08074be2111cbc7af72df295 Reviewed-on: https://cl.fcuny.net/c/world/+/404 Tested-by: CI Reviewed-by: Franck Cuny <franck@fcuny.net>
Diffstat (limited to 'nix/private-wireguard.nix')
-rw-r--r--nix/private-wireguard.nix27
1 files changed, 15 insertions, 12 deletions
diff --git a/nix/private-wireguard.nix b/nix/private-wireguard.nix
index 706dfd8..8e5d74c 100644
--- a/nix/private-wireguard.nix
+++ b/nix/private-wireguard.nix
@@ -10,7 +10,8 @@ let
allPeers = wgcfg.peers;
thisPeer = allPeers."${hostname}" or null;
otherPeers = lib.filterAttrs (n: v: n != hostname) allPeers;
-in {
+in
+{
options.networking.private-wireguard = {
enable = mkEnableOption "Enable private wireguard vpn connection";
};
@@ -24,17 +25,19 @@ in {
"${wgcfg.subnet4}.${toString thisPeer.ipv4}/${toString wgcfg.mask4}"
];
- peers = lib.mapAttrsToList (name: peer:
- {
- allowedIPs = [
- "${wgcfg.subnet4}.${toString peer.ipv4}/${toString wgcfg.mask4}"
- ];
- publicKey = peer.key;
- } // lib.optionalAttrs (peer ? externalIp) {
- endpoint = "${peer.externalIp}:${toString port}";
- } // lib.optionalAttrs (!(thisPeer ? externalIp)) {
- persistentKeepalive = 10;
- }) otherPeers;
+ peers = lib.mapAttrsToList
+ (name: peer:
+ {
+ allowedIPs = [
+ "${wgcfg.subnet4}.${toString peer.ipv4}/${toString wgcfg.mask4}"
+ ];
+ publicKey = peer.key;
+ } // lib.optionalAttrs (peer ? externalIp) {
+ endpoint = "${peer.externalIp}:${toString port}";
+ } // lib.optionalAttrs (!(thisPeer ? externalIp)) {
+ persistentKeepalive = 10;
+ })
+ otherPeers;
};
};
};