From a03996d7a11edc84e231f513ef134f9f58d44ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 18 Aug 2022 08:43:38 +0200 Subject: nixos: work little bit on routers --- nixos/modules/router.nix | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 nixos/modules/router.nix (limited to 'nixos/modules/router.nix') diff --git a/nixos/modules/router.nix b/nixos/modules/router.nix new file mode 100644 index 0000000..e65ef10 --- /dev/null +++ b/nixos/modules/router.nix @@ -0,0 +1,58 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + + cnf = config.cynerd.router; + +in { + + options = { + cynerd.router = { + enable = mkOption { + type = types.bool; + default = false; + description = "Enable router support"; + }; + wan = mkOption { + type = types.string; + description = "Interface for the router's WAN"; + }; + brlan = mkOption { + type = types.string; + default = "brlan"; + description = "LAN interface (commonly some bridge)"; + }; + # TODO IP range and so on + }; + }; + + config = mkIf cnf { + + # TODO firewall NAT + networking = { + + }; + + services.dhcpd4 = { + enable = true; + authoritative = true; + interfaces = [ "brlan" ]; + extraConfig = '' + ''; + }; + + services.dhcpd6 = { + enable = true; + authoritative = true; + interfaces = [ "brlan" ]; + extraConfig = '' + ''; + }; + + services.kresd = { + enable = true; + }; + + }; +} -- cgit v1.2.3