You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
4.3 KiB
Nix

3 years ago
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.ffnix;
in
{
options.ffnix = {
enable = mkEnableOption "ffnix";
batmanLegacy = mkOption {
3 years ago
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 = {
3 years ago
enable = mkEnableOption "ffnix Domain";
ipv4Prefix = mkOption {
type = types.str;
};
ipv6Prefixes = mkOption {
type = types.listOf types.str;
};
3 years ago
ipv4Addresses = mkOption {
type = types.listOf types.str;
3 years ago
description = ''
3 years ago
IPv4 Addresses to be configured on the bridge interface.
3 years ago
WARNING: the primary-ipv4-address to be send as a gateway address via DHCP has to be the first one.
'';
};
3 years ago
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.
3 years ago
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;
};
3 years ago
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 = {};
3 years ago
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;
};
};
};
};
};
};
};
};
});
};
3 years ago
};
config = mkIf cfg.enable {
services.vnstat.enable = true;
programs.mtr.enable = true;
3 years ago
};
imports = [
./modules
3 years ago
./modules/batman.nix
3 years ago
./modules/fastd.nix
./modules/bird
3 years ago
];
}