Remove libs directory
This commit is contained in:
parent
88eb75c85a
commit
d90be28dee
3 changed files with 1 additions and 33 deletions
|
@ -1 +0,0 @@
|
|||
{ lib }: rec { wireguard = import ./wireguard.nix { lib = lib; }; }
|
|
@ -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;
|
||||
});
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
self: super: {
|
||||
lib = (super.lib or { }) // { qois = import ../lib { lib = self.lib; }; };
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue