nix #11
|
@ -8,7 +8,6 @@
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
country=NL
|
country=NL
|
||||||
'';
|
'';
|
||||||
interfaces = ["eth0"];
|
|
||||||
};
|
};
|
||||||
environment.systemPackages = with pkgs; [ wirelesstools ];
|
environment.systemPackages = with pkgs; [ wirelesstools ];
|
||||||
services.chrony.serverOption = "offline";
|
services.chrony.serverOption = "offline";
|
||||||
|
|
|
@ -43,6 +43,9 @@ class Password:
|
||||||
def val(self) -> str:
|
def val(self) -> str:
|
||||||
return self.content
|
return self.content
|
||||||
|
|
||||||
|
def exists(self) -> bool:
|
||||||
|
return not not self.content
|
||||||
|
|
||||||
def key(self) -> str:
|
def key(self) -> str:
|
||||||
if SEPARATE_PASSWORDS:
|
if SEPARATE_PASSWORDS:
|
||||||
return f"@{self.var()}@"
|
return f"@{self.var()}@"
|
||||||
|
@ -109,7 +112,7 @@ for path in list_networks():
|
||||||
|
|
||||||
# Helpers to prevent repetition
|
# Helpers to prevent repetition
|
||||||
suffixes = data.pop("suffixes", [""])
|
suffixes = data.pop("suffixes", [""])
|
||||||
data.setdefault("key_mgmt", ["WPA-PSK"] if password else ["NONE"])
|
data.setdefault("key_mgmt", ["WPA-PSK"] if password.exists() else ["NONE"])
|
||||||
if password:
|
if password:
|
||||||
if any(map(lambda m: "PSK" in m.split("-"), data["key_mgmt"])):
|
if any(map(lambda m: "PSK" in m.split("-"), data["key_mgmt"])):
|
||||||
data["psk"] = password
|
data["psk"] = password
|
||||||
|
@ -140,7 +143,7 @@ for path in list_networks():
|
||||||
if key_mgmt:
|
if key_mgmt:
|
||||||
network["authProtocols"] = key_mgmt
|
network["authProtocols"] = key_mgmt
|
||||||
if psk:
|
if psk:
|
||||||
network["pskRaw"] = psk.key()
|
network["psk"] = psk.key()
|
||||||
if data:
|
if data:
|
||||||
raise NotImplementedError(f"{path}: Unhandled non-auth extra: {data}")
|
raise NotImplementedError(f"{path}: Unhandled non-auth extra: {data}")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue