nix #11

Manually merged
geoffrey merged 113 commits from nix into main 2023-12-09 21:43:01 +01:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit 63b5e9c252 - Show all commits

View file

@ -8,7 +8,6 @@
extraConfig = ''
country=NL
'';
interfaces = ["eth0"];
};
environment.systemPackages = with pkgs; [ wirelesstools ];
services.chrony.serverOption = "offline";

View file

@ -43,6 +43,9 @@ class Password:
def val(self) -> str:
return self.content
def exists(self) -> bool:
return not not self.content
def key(self) -> str:
if SEPARATE_PASSWORDS:
return f"@{self.var()}@"
@ -109,7 +112,7 @@ for path in list_networks():
# Helpers to prevent repetition
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 any(map(lambda m: "PSK" in m.split("-"), data["key_mgmt"])):
data["psk"] = password
@ -140,7 +143,7 @@ for path in list_networks():
if key_mgmt:
network["authProtocols"] = key_mgmt
if psk:
network["pskRaw"] = psk.key()
network["psk"] = psk.key()
if data:
raise NotImplementedError(f"{path}: Unhandled non-auth extra: {data}")
else: