summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2022-10-06 06:36:16 -0400
committerKjetil Orbekk <kj@orbekk.com>2022-10-06 06:36:16 -0400
commite8bc9ab190ba5bc4e5f76950ae7103133021da20 (patch)
tree08486fbf3becf244e8f4e9aee7a8b11e3d589842
parent6d19f59b085d162d25c027d3d7014aefd95020ee (diff)
Formatting
-rw-r--r--modules/vpn.nix28
1 files changed, 14 insertions, 14 deletions
diff --git a/modules/vpn.nix b/modules/vpn.nix
index 0b532de..635bcd4 100644
--- a/modules/vpn.nix
+++ b/modules/vpn.nix
@@ -23,28 +23,26 @@ let
firelink = mkConfig "firelink" "2001";
pincer = mkConfig "pincer" "2002";
steamdeck = mkConfig "steamdeck" "2003" // {
- ips = [
- "${vpn-prefix}::2003/128"
- "${vpn-prefix}::2004/128"
- ];
+ ips = [ "${vpn-prefix}::2003/128" "${vpn-prefix}::2004/128" ];
};
};
mkPeer = hostConfig: {
inherit (hostConfig) publicKey endpoint;
- allowedIPs = if hostConfig.router && !cfg.is_server then [ "${vpn-prefix}::/64" ] else hostConfig.ips;
+ allowedIPs = if hostConfig.router && !cfg.is_server then
+ [ "${vpn-prefix}::/64" ]
+ else
+ hostConfig.ips;
};
getPeers = host:
- if
- host == "dragon"
- then
- builtins.map mkPeer (builtins.attrValues (builtins.removeAttrs hosts [host]))
+ if host == "dragon" then
+ builtins.map mkPeer
+ (builtins.attrValues (builtins.removeAttrs hosts [ host ]))
else
- builtins.map mkPeer [hosts.dragon];
+ builtins.map mkPeer [ hosts.dragon ];
-in
-{
+in {
options = {
orbekk.vpn = {
enable = lib.mkEnableOption "Enable VPN";
@@ -66,7 +64,8 @@ in
orbekk.simple-firewall.allowedUDPPorts = [ cfg.listenPort ];
age.secrets = {
- "${config.networking.hostName}-wireguard-key".file = ./. + "/../secrets/${config.networking.hostName}-wireguard-key.age";
+ "${config.networking.hostName}-wireguard-key".file = ./.
+ + "/../secrets/${config.networking.hostName}-wireguard-key.age";
};
networking.networkmanager.unmanaged = [ "vpn" ];
@@ -75,7 +74,8 @@ in
enable = true;
interfaces.vpn = {
ips = hosts.${config.networking.hostName}.ips;
- privateKeyFile = "${config.age.secrets."${config.networking.hostName}-wireguard-key".path}";
+ privateKeyFile =
+ "${config.age.secrets."${config.networking.hostName}-wireguard-key".path}";
allowedIPsAsRoutes = true;
listenPort = cfg.listenPort;
peers = getPeers config.networking.hostName;