chore: reformat
This commit is contained in:
parent
b638c4125b
commit
1402ee13cc
57 changed files with 845 additions and 466 deletions
|
@ -1,28 +1,32 @@
|
|||
{ config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.dadada.vpnServer;
|
||||
wgPeer = { name, ... }: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
internal = true;
|
||||
default = name;
|
||||
};
|
||||
id = mkOption {
|
||||
description = "VPN client id";
|
||||
default = 0;
|
||||
type = types.str;
|
||||
};
|
||||
key = mkOption {
|
||||
description = "VPN client public key";
|
||||
default = "";
|
||||
type = types.str;
|
||||
wgPeer =
|
||||
{ name, ... }:
|
||||
{
|
||||
options = {
|
||||
name = mkOption {
|
||||
internal = true;
|
||||
default = name;
|
||||
};
|
||||
id = mkOption {
|
||||
description = "VPN client id";
|
||||
default = 0;
|
||||
type = types.str;
|
||||
};
|
||||
key = mkOption {
|
||||
description = "VPN client public key";
|
||||
default = "";
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.dadada.vpnServer = {
|
||||
|
@ -41,13 +45,10 @@ in
|
|||
privateKeyFile = "/var/lib/wireguard/wg0-key";
|
||||
ips = [ "fd42:9c3b:f96d:0201::0/64" ];
|
||||
listenPort = 51234;
|
||||
peers =
|
||||
map
|
||||
(peer: {
|
||||
allowedIPs = [ "fd42:9c3b:f96d:0201::${peer.id}/128" ];
|
||||
publicKey = peer.key;
|
||||
})
|
||||
(attrValues cfg.peers);
|
||||
peers = map (peer: {
|
||||
allowedIPs = [ "fd42:9c3b:f96d:0201::${peer.id}/128" ];
|
||||
publicKey = peer.key;
|
||||
}) (attrValues cfg.peers);
|
||||
postSetup = ''
|
||||
wg set wg0 fwmark 51234
|
||||
ip -6 route add table 2468 fd42:9c3b:f96d::/48 dev ens3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue