chore: reformat

This commit is contained in:
Tim Schubert 2025-06-03 20:04:44 +02:00
parent b638c4125b
commit 1402ee13cc
No known key found for this signature in database
57 changed files with 845 additions and 466 deletions

View file

@ -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