aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-08-18 08:43:38 +0200
committerKarel Kočí <cynerd@email.cz>2022-08-18 08:43:38 +0200
commita03996d7a11edc84e231f513ef134f9f58d44ccf (patch)
tree632b6e139d8c2d291353b40fc5f1f3757843c4f6 /nixos/modules
parentd558ed3b71a0c51338c1cffcf648dc6a0e3ecf5b (diff)
downloadnixos-personal-a03996d7a11edc84e231f513ef134f9f58d44ccf.tar.gz
nixos-personal-a03996d7a11edc84e231f513ef134f9f58d44ccf.tar.bz2
nixos-personal-a03996d7a11edc84e231f513ef134f9f58d44ccf.zip
nixos: work little bit on routers
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;
+ };
+
+ };
+}