1
0

Compare commits

...

2 Commits

Author SHA1 Message Date
7fad66ff27 fix makestep type 2023-07-22 23:50:01 +01:00
9994c161d4 DRY up wireless config 2023-07-22 23:37:01 +01:00
2 changed files with 24 additions and 22 deletions

View File

@ -21,6 +21,17 @@ let
writeFennelScript writeFennelScript
serviceFns; serviceFns;
svc = config.system.service; svc = config.system.service;
wirelessConfig = {
country_code = "GB";
inherit (secrets) wpa_passphrase;
auth_algs = 1; # 1=wpa2, 2=wep, 3=both
wpa = 2; # 1=wpa, 2=wpa2, 3=both
wpa_key_mgmt = "WPA-PSK";
wpa_pairwise = "TKIP CCMP"; # auth for wpa (may not need this?)
rsn_pairwise = "CCMP"; # auth for wpa2
wmm_enabled = 1;
};
in rec { in rec {
boot = { boot = {
tftp = { tftp = {
@ -47,40 +58,23 @@ in rec {
interface = config.hardware.networkInterfaces.wlan_24; interface = config.hardware.networkInterfaces.wlan_24;
params = { params = {
ssid = "liminix"; ssid = "liminix";
country_code = "GB";
hw_mode="g"; hw_mode="g";
channel = "2"; channel = "2";
wmm_enabled = 1;
ieee80211n = 1; ieee80211n = 1;
inherit (secrets) wpa_passphrase; } // wirelessConfig;
auth_algs = 1; # 1=wpa2, 2=wep, 3=both
wpa = 2; # 1=wpa, 2=wpa2, 3=both
wpa_key_mgmt = "WPA-PSK";
wpa_pairwise = "TKIP CCMP"; # auth for wpa (may not need this?)
rsn_pairwise = "CCMP"; # auth for wpa2
};
}; };
services.hostap5 = svc.hostapd { services.hostap5 = svc.hostapd {
interface = config.hardware.networkInterfaces.wlan_5; interface = config.hardware.networkInterfaces.wlan_5;
params = rec { params = rec {
ssid = "liminix_5"; ssid = "liminix_5";
country_code = "GB";
hw_mode="a"; hw_mode="a";
channel = 36; channel = 36;
ht_capab = "[HT40+]"; ht_capab = "[HT40+]";
vht_oper_chwidth = 1; vht_oper_chwidth = 1;
vht_oper_centr_freq_seg0_idx = channel + 6; vht_oper_centr_freq_seg0_idx = channel + 6;
ieee80211ac = 1; ieee80211ac = 1;
} // wirelessConfig;
wmm_enabled = 1;
inherit (secrets) wpa_passphrase;
auth_algs = 1; # 1=wpa2, 2=wep, 3=both
wpa = 2; # 1=wpa, 2=wpa2, 3=both
wpa_key_mgmt = "WPA-PSK";
wpa_pairwise = "TKIP CCMP"; # auth for wpa (may not need this?)
rsn_pairwise = "CCMP"; # auth for wpa2
};
}; };
services.int = services.int =

View File

@ -20,9 +20,15 @@ let
servers = mkOption { type = types.attrsOf serverOpts; default = {}; }; servers = mkOption { type = types.attrsOf serverOpts; default = {}; };
pools = mkOption { type = types.attrsOf serverOpts; default = {}; }; pools = mkOption { type = types.attrsOf serverOpts; default = {}; };
peers = mkOption { type = types.attrsOf serverOpts; default = {}; }; peers = mkOption { type = types.attrsOf serverOpts; default = {}; };
makestep = { makestep = mkOption {
threshold = mkOption { type = types.number; }; default = null;
limit = mkOption { type = types.number; }; type = types.nullOr
(types.submodule {
options = {
threshold = mkOption { type = types.number; default = null;};
limit = mkOption { type = types.number; };
};
});
}; };
allow = mkOption { allow = mkOption {
description = "subnets from which NTP clients are allowed to access the server"; description = "subnets from which NTP clients are allowed to access the server";
@ -48,6 +54,8 @@ let
}; };
}; };
configFile = p: configFile = p:
assert (builtins.trace p.makestep true);
(mapAttrsToList (name: opts: "server ${name} ${concatStringsSep "" opts}") (mapAttrsToList (name: opts: "server ${name} ${concatStringsSep "" opts}")
p.servers) p.servers)
++ ++