From 1c609f5e95e47c46d9b78da801334fc42aeb5cbf Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Thu, 9 Feb 2023 14:51:22 +0800 Subject: [PATCH] chore: reformat the codebase --- hosts/plover/modules/hardware/networks.nix | 27 ++++++++++++--------- hosts/plover/modules/services/coredns.nix | 7 +++--- hosts/plover/modules/services/keycloak.nix | 15 ++++++------ hosts/plover/modules/services/wireguard.nix | 12 +++++---- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/hosts/plover/modules/hardware/networks.nix b/hosts/plover/modules/hardware/networks.nix index 0143624f..f08742f4 100644 --- a/hosts/plover/modules/hardware/networks.nix +++ b/hosts/plover/modules/hardware/networks.nix @@ -26,17 +26,22 @@ rec { ipv6Gateway = "fe80::1"; in { - # This is the public-facing interface. Any interface name with a prime - # symbol means it's a public-facing interface. - main' = { - # The gateways for the public addresses are retrieved from the following - # pages: - # - # * https://docs.hetzner.com/cloud/networks/faq/#are-any-ip-addresses-reserved - # * https://docs.hetzner.com/robot/dedicated-server/ip/additional-ip-adresses/#gateway - IPv4 = { - address = "65.109.224.213"; - gateway = "172.31.1.1"; + # This is the public-facing interface. Any interface name with a prime + # symbol means it's a public-facing interface. + main' = { + # The gateways for the public addresses are retrieved from the following + # pages: + # + # * https://docs.hetzner.com/cloud/networks/faq/#are-any-ip-addresses-reserved + # * https://docs.hetzner.com/robot/dedicated-server/ip/additional-ip-adresses/#gateway + IPv4 = { + address = "65.109.224.213"; + gateway = "172.31.1.1"; + }; + IPv6 = { + address = "2a01:4f9:c012:607a::1"; + gateway = ipv6Gateway; + }; }; internal = { diff --git a/hosts/plover/modules/services/coredns.nix b/hosts/plover/modules/services/coredns.nix index 88a6ecf9..e95a8e8c 100644 --- a/hosts/plover/modules/services/coredns.nix +++ b/hosts/plover/modules/services/coredns.nix @@ -47,7 +47,8 @@ let domainZoneFile' = "/etc/coredns/zones/${domain}.zone"; in { - sops.secrets = let + sops.secrets = + let getKey = key: { inherit key; sopsFile = ../../secrets/secrets.yaml; @@ -58,8 +59,8 @@ in lib.nameValuePair "plover/${secret}" ((getKey secret) // config)) - secrets; - in + secrets; + in getSecrets { "dns/mailbox-security-key" = { }; "dns/mailbox-security-key-record" = { }; diff --git a/hosts/plover/modules/services/keycloak.nix b/hosts/plover/modules/services/keycloak.nix index 7766e305..445df9af 100644 --- a/hosts/plover/modules/services/keycloak.nix +++ b/hosts/plover/modules/services/keycloak.nix @@ -78,13 +78,14 @@ in # This is based from the reverse proxy guide from the official # documentation at https://www.keycloak.org/server/reverseproxy. - locations = let - keycloakPath = path: "http://${host}:${toString config.services.keycloak.settings.http-port}"; - in - lib.listToAttrs - (lib.lists.map - (appPath: lib.nameValuePair appPath { proxyPass = keycloakPath appPath; }) - [ "/js/" "/realms/" "/resources/" "/robots.txt" ]); + locations = + let + keycloakPath = path: "http://${host}:${toString config.services.keycloak.settings.http-port}"; + in + lib.listToAttrs + (lib.lists.map + (appPath: lib.nameValuePair appPath { proxyPass = keycloakPath appPath; }) + [ "/js/" "/realms/" "/resources/" "/robots.txt" ]); }; "${authInternalDomain}" = { diff --git a/hosts/plover/modules/services/wireguard.nix b/hosts/plover/modules/services/wireguard.nix index f1860ebe..3de134ac 100644 --- a/hosts/plover/modules/services/wireguard.nix +++ b/hosts/plover/modules/services/wireguard.nix @@ -71,11 +71,13 @@ in { routeConfig = { Gateway = wireguardPeers.server.IPv4; - Destination = let - ip = lib.strings.splitString "." wireguardPeers.server.IPv4; - properRange = lib.lists.take 3 ip ++ [ "0" ]; - ip' = lib.concatStringsSep "." properRange; - in "${ip'}/16"; + Destination = + let + ip = lib.strings.splitString "." wireguardPeers.server.IPv4; + properRange = lib.lists.take 3 ip ++ [ "0" ]; + ip' = lib.concatStringsSep "." properRange; + in + "${ip'}/16"; }; } ];