switch to nixpkgs-fmt
This commit is contained in:
parent
8cd6ed1502
commit
c43341a8b2
69 changed files with 664 additions and 665 deletions
|
@ -1,12 +1,11 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
{ config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.dadada.vpnServer;
|
||||
wgPeer = {name, ...}: {
|
||||
wgPeer = { name, ... }: {
|
||||
options = {
|
||||
name = mkOption {
|
||||
internal = true;
|
||||
|
@ -24,13 +23,14 @@ with lib; let
|
|||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.dadada.vpnServer = {
|
||||
enable = mkEnableOption "Enable wireguard gateway";
|
||||
peers = mkOption {
|
||||
description = "Set of extensions and public keys of peers";
|
||||
type = with types; attrsOf (submodule wgPeer);
|
||||
default = {};
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -39,15 +39,15 @@ in {
|
|||
interfaces."wg0" = {
|
||||
allowedIPsAsRoutes = true;
|
||||
privateKeyFile = "/var/lib/wireguard/wg0-key";
|
||||
ips = ["fd42:9c3b:f96d:0201::0/64"];
|
||||
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);
|
||||
(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