This repository has been archived by the owner on Sep 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
152 lines (146 loc) · 4.26 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.ffnix;
in
{
options.ffnix = {
enable = mkEnableOption "ffnix";
batmanLegacy = mkOption {
default = false;
example = true;
type = types.bool;
description = ''
Use batman-adv-legacy - do not use in new communities!
'';
};
bird = {
enable = mkEnableOption "bird routing daemon";
routerID = mkOption {
type = types.str;
};
kernelTable = mkOption {
type= types.int;
};
earlyExtraConfig = mkOption {
type = types.lines;
default = "";
};
extraConfig = mkOption {
type = types.lines;
default = "";
};
};
domains = mkOption {
description = "Freifunk Domains (a domain is a seperated L2 network segment)";
default = {};
type = with types; attrsOf (submodule {
options = {
enable = mkEnableOption "ffnix Domain";
ipv4Prefix = mkOption {
type = types.str;
};
ipv6Prefixes = mkOption {
type = types.listOf types.str;
};
ipv4Addresses = mkOption {
type = types.listOf types.str;
description = ''
IPv4 Addresses to be configured on the bridge interface.
WARNING: the primary-ipv4-address to be send as a gateway address via DHCP has to be the first one.
'';
};
ipv6Addresses = mkOption {
type = types.listOf types.str;
description = ''
IPv6 Addresses to be configured on the bridge interface.
'';
};
routingTable = mkOption {
type = types.int;
};
defaultNullRoute = mkOption {
type = types.bool;
default = true;
description = ''
Create a Null-Route in the routing-table to allow traffic leaks on the gateways default route when uplink is down.
The first address will be sen't as the DNS-Server via RAs.
'';
};
mtu = mkOption {
type = types.int;
};
enableRadvd = mkOption {
default = false;
type = types.bool;
};
radvdPrefixes = mkOption {
default = [];
type = types.listOf types.str;
};
dhcpRange = mkOption {
default = "";
type = types.str;
};
searchDomain = mkOption {
type = types.str;
};
dhcpExtraConfig = mkOption {
description = ''
Additional config that will me merged with the kea-subnet4 config
'';
default = {};
type = (pkgs.formats.json {}).type;
};
batmanAlgorithm = mkOption {
default = "batman-iv";
type = types.str;
};
tunnels = mkOption {
default = {};
type = types.submodule {
options = {
fastd = mkOption {
default = {};
type = types.submodule {
options = {
enable = mkEnableOption "Fastd Tunnel";
mtu = mkOption {
type = types.int;
default = 1406;
};
port = mkOption {
type = types.int;
default = 10000;
};
interfaceMac = mkOption {
type = types.str;
};
extraConfig = mkOption {
description = ''
Additional config that will me merged with the fastd-instance config
'';
default = {};
type = (pkgs.formats.json {}).type;
};
};
};
};
};
};
};
};
});
};
};
config = mkIf cfg.enable {
services.vnstat.enable = true;
programs.mtr.enable = true;
};
imports = [
./modules
./modules/batman.nix
./modules/fastd.nix
./modules/bird
];
}