aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/router.nix58
1 files changed, 58 insertions, 0 deletions
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;
+ };
+
+ };
+}