From 69269c05a822dda1b0519dda29b54a19f78c132a Mon Sep 17 00:00:00 2001 From: Fabian Hauser Date: Tue, 19 May 2020 20:27:55 +0000 Subject: [PATCH] Fix syntax errors --- host/etzel.nix | 2 +- role/router-dhcp/default.nix | 6 +++--- role/router-dns/default.nix | 4 ++-- role/router-wireless-ap/default.nix | 11 +++++++---- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/host/etzel.nix b/host/etzel.nix index 0ac6e99..fb8b3ba 100644 --- a/host/etzel.nix +++ b/host/etzel.nix @@ -16,7 +16,7 @@ ../role/router-wireless-ap ]; - service.router = { + services.router = { enable = true; wanInterface = "enp2s0"; wirelessInterfaces = [ "wlp4s0" "wlp6s0" ]; diff --git a/role/router-dhcp/default.nix b/role/router-dhcp/default.nix index 9c3b59c..ad43061 100644 --- a/role/router-dhcp/default.nix +++ b/role/router-dhcp/default.nix @@ -25,7 +25,7 @@ in { ''; }; - lanLocalDnsPort = mkOption { + localDnsPort = mkOption { type = types.addCheck types.int (n: n >= 0 && n <= 65535); example = "router"; default = 5553; @@ -42,7 +42,7 @@ in { # Listen on this specific port instead of the standard DNS port # (53). Setting this to zero completely disables DNS function, # leaving only DHCP and/or TFTP. - port=${cfg.localDnsPort} + port=${toString cfg.localDnsPort} # The following two options make you a better netizen, since they # tell dnsmasq to filter out queries which the public DNS cannot @@ -100,7 +100,7 @@ in { # The example below send any host in double-click.net to a local # web-server. #address=/double-click.net/127.0.0.1 - address=/${cfg.routerHostName}.${cfg.localDomain}/${routerCfg.internalRouterIP} + address=/${config.networking.hostName}.${cfg.localDomain}/${routerCfg.internalRouterIP} # --address (and --server) work with IPv6 addresses too. #address=/www.thekelleys.org.uk/fe80::20d:60ff:fe36:f83 diff --git a/role/router-dns/default.nix b/role/router-dns/default.nix index f754604..e87ceab 100644 --- a/role/router-dns/default.nix +++ b/role/router-dns/default.nix @@ -41,11 +41,11 @@ in { forward-zone: name: "${dhcpCfg.localDomain}." - forward-addr: 127.0.0.1@${dhcpCfg.lanLocalDnsPort} + forward-addr: 127.0.0.1@${toString dhcpCfg.localDnsPort} forward-zone: name: "${revIpDomain}.in-addr.arpa." - forward-addr: 127.0.0.1@${dhcpCfg.lanLocalDnsPort} + forward-addr: 127.0.0.1@${toString dhcpCfg.localDnsPort} ''; }; }; diff --git a/role/router-wireless-ap/default.nix b/role/router-wireless-ap/default.nix index 76b3c5b..4f722fc 100644 --- a/role/router-wireless-ap/default.nix +++ b/role/router-wireless-ap/default.nix @@ -6,11 +6,12 @@ let routerCfg = config.services.router; cfg = config.services.router.wireless; in { - options.services.wireless = { + options.services.router.wireless = { enable = mkEnableOption "router wireless service"; wleInterface24Ghz = mkOption { type = with types; nullOr str; + default = null; example = "wlp1"; description = '' Wireless interface name for 2.4 GHz wireless band. @@ -19,6 +20,7 @@ in { wleInterface5Ghz = mkOption { type = with types; nullOr str; + default = null; example = "wlp2"; description = '' Wireless interface name for 5 GHz wireless band. @@ -49,11 +51,12 @@ in { }; }; - imports = mkIf cfg.enable [ ./hostapd5ghz.nix ]; + #imports = mkIf cfg.enable [ ./hostapd5ghz.nix ]; + imports = [ ./hostapd5ghz.nix ]; config = let wle24GhzEnabled = cfg.wleInterface24Ghz != null; - wle5GhzEnabled = wleInterface5Ghz != null; + wle5GhzEnabled = cfg.wleInterface5Ghz != null; in mkIf cfg.enable { boot.extraModprobeConfig = '' options cfg80211 ieee80211_regdom=${cfg.regulatoryCountryCode} @@ -135,7 +138,7 @@ in { services.hostapd = { enable = wle24GhzEnabled; - interface = wleInterface; + interface = cfg.wleInterface24Ghz; hwMode = "g"; ssid = cfg.ssid; wpaPassphrase = cfg.passphrase;