Fix syntax errors
This commit is contained in:
parent
87792bd9af
commit
69269c05a8
4 changed files with 13 additions and 10 deletions
|
@ -16,7 +16,7 @@
|
||||||
../role/router-wireless-ap
|
../role/router-wireless-ap
|
||||||
];
|
];
|
||||||
|
|
||||||
service.router = {
|
services.router = {
|
||||||
enable = true;
|
enable = true;
|
||||||
wanInterface = "enp2s0";
|
wanInterface = "enp2s0";
|
||||||
wirelessInterfaces = [ "wlp4s0" "wlp6s0" ];
|
wirelessInterfaces = [ "wlp4s0" "wlp6s0" ];
|
||||||
|
|
|
@ -25,7 +25,7 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
lanLocalDnsPort = mkOption {
|
localDnsPort = mkOption {
|
||||||
type = types.addCheck types.int (n: n >= 0 && n <= 65535);
|
type = types.addCheck types.int (n: n >= 0 && n <= 65535);
|
||||||
example = "router";
|
example = "router";
|
||||||
default = 5553;
|
default = 5553;
|
||||||
|
@ -42,7 +42,7 @@ in {
|
||||||
# Listen on this specific port instead of the standard DNS port
|
# Listen on this specific port instead of the standard DNS port
|
||||||
# (53). Setting this to zero completely disables DNS function,
|
# (53). Setting this to zero completely disables DNS function,
|
||||||
# leaving only DHCP and/or TFTP.
|
# leaving only DHCP and/or TFTP.
|
||||||
port=${cfg.localDnsPort}
|
port=${toString cfg.localDnsPort}
|
||||||
|
|
||||||
# The following two options make you a better netizen, since they
|
# The following two options make you a better netizen, since they
|
||||||
# tell dnsmasq to filter out queries which the public DNS cannot
|
# 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
|
# The example below send any host in double-click.net to a local
|
||||||
# web-server.
|
# web-server.
|
||||||
#address=/double-click.net/127.0.0.1
|
#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 (and --server) work with IPv6 addresses too.
|
||||||
#address=/www.thekelleys.org.uk/fe80::20d:60ff:fe36:f83
|
#address=/www.thekelleys.org.uk/fe80::20d:60ff:fe36:f83
|
||||||
|
|
|
@ -41,11 +41,11 @@ in {
|
||||||
|
|
||||||
forward-zone:
|
forward-zone:
|
||||||
name: "${dhcpCfg.localDomain}."
|
name: "${dhcpCfg.localDomain}."
|
||||||
forward-addr: 127.0.0.1@${dhcpCfg.lanLocalDnsPort}
|
forward-addr: 127.0.0.1@${toString dhcpCfg.localDnsPort}
|
||||||
|
|
||||||
forward-zone:
|
forward-zone:
|
||||||
name: "${revIpDomain}.in-addr.arpa."
|
name: "${revIpDomain}.in-addr.arpa."
|
||||||
forward-addr: 127.0.0.1@${dhcpCfg.lanLocalDnsPort}
|
forward-addr: 127.0.0.1@${toString dhcpCfg.localDnsPort}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,11 +6,12 @@ let
|
||||||
routerCfg = config.services.router;
|
routerCfg = config.services.router;
|
||||||
cfg = config.services.router.wireless;
|
cfg = config.services.router.wireless;
|
||||||
in {
|
in {
|
||||||
options.services.wireless = {
|
options.services.router.wireless = {
|
||||||
enable = mkEnableOption "router wireless service";
|
enable = mkEnableOption "router wireless service";
|
||||||
|
|
||||||
wleInterface24Ghz = mkOption {
|
wleInterface24Ghz = mkOption {
|
||||||
type = with types; nullOr str;
|
type = with types; nullOr str;
|
||||||
|
default = null;
|
||||||
example = "wlp1";
|
example = "wlp1";
|
||||||
description = ''
|
description = ''
|
||||||
Wireless interface name for 2.4 GHz wireless band.
|
Wireless interface name for 2.4 GHz wireless band.
|
||||||
|
@ -19,6 +20,7 @@ in {
|
||||||
|
|
||||||
wleInterface5Ghz = mkOption {
|
wleInterface5Ghz = mkOption {
|
||||||
type = with types; nullOr str;
|
type = with types; nullOr str;
|
||||||
|
default = null;
|
||||||
example = "wlp2";
|
example = "wlp2";
|
||||||
description = ''
|
description = ''
|
||||||
Wireless interface name for 5 GHz wireless band.
|
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
|
config = let
|
||||||
wle24GhzEnabled = cfg.wleInterface24Ghz != null;
|
wle24GhzEnabled = cfg.wleInterface24Ghz != null;
|
||||||
wle5GhzEnabled = wleInterface5Ghz != null;
|
wle5GhzEnabled = cfg.wleInterface5Ghz != null;
|
||||||
in mkIf cfg.enable {
|
in mkIf cfg.enable {
|
||||||
boot.extraModprobeConfig = ''
|
boot.extraModprobeConfig = ''
|
||||||
options cfg80211 ieee80211_regdom=${cfg.regulatoryCountryCode}
|
options cfg80211 ieee80211_regdom=${cfg.regulatoryCountryCode}
|
||||||
|
@ -135,7 +138,7 @@ in {
|
||||||
|
|
||||||
services.hostapd = {
|
services.hostapd = {
|
||||||
enable = wle24GhzEnabled;
|
enable = wle24GhzEnabled;
|
||||||
interface = wleInterface;
|
interface = cfg.wleInterface24Ghz;
|
||||||
hwMode = "g";
|
hwMode = "g";
|
||||||
ssid = cfg.ssid;
|
ssid = cfg.ssid;
|
||||||
wpaPassphrase = cfg.passphrase;
|
wpaPassphrase = cfg.passphrase;
|
||||||
|
|
Loading…
Add table
Reference in a new issue