From d90be28dee7b0fd52791cbb901a97392bbc9453f Mon Sep 17 00:00:00 2001 From: Fabian Hauser Date: Sun, 10 Apr 2022 16:36:36 +0200 Subject: [PATCH] Remove libs directory --- lib/default.nix | 1 - lib/wireguard.nix | 31 ------------------------------- overlays/default.nix | 2 +- 3 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 lib/default.nix delete mode 100644 lib/wireguard.nix diff --git a/lib/default.nix b/lib/default.nix deleted file mode 100644 index c3e7e08..0000000 --- a/lib/default.nix +++ /dev/null @@ -1 +0,0 @@ -{ lib }: rec { wireguard = import ./wireguard.nix { lib = lib; }; } diff --git a/lib/wireguard.nix b/lib/wireguard.nix deleted file mode 100644 index 62dfd59..0000000 --- a/lib/wireguard.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ lib }: rec { - - mapHostToPeerConfig = (netname: host: hostconf: { - - # Generate the preshared key with wg genpsk - presharedKeyFile = "/secrets/wireguard/preshared/${netname}-${host}"; - publicKey = hostconf.publicKey; - - endpoint = hostconf.endpoint; - - allowedIPs = [ hostconf.v4.ip ]; - persistentKeepalive = hostconf.persistentKeepalive; - }); - - makeInterface = (hostName: netname: netconfig: - let isHub = netconfig.server.hostname == hostName; - in { - ips = [ - "${netconfig.hosts.${hostName}.v4.ip}/${toString netconfig.v4.bitmask}" - ]; - listenPort = if isHub then netconfig.server.port else null; - privateKeyFile = "/secrets/wireguard/private/${netname}"; - generatePrivateKeyFile = true; - - peers = let - reachablePeerHosts = lib.filterAttrs (host: hostconf: - host != hostName && (hostconf.endpoint != null || isHub)) - netconfig.hosts; - in lib.mapAttrsToList (mapHostToPeerConfig netname) reachablePeerHosts; - }); -} diff --git a/overlays/default.nix b/overlays/default.nix index 1ffdb20..478c7b6 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,3 +1,3 @@ self: super: { - lib = (super.lib or { }) // { qois = import ../lib { lib = self.lib; }; }; + }