networks: fix ordering and add new network

This commit is contained in:
Primrose 2025-12-13 21:40:39 +08:00
parent a1dd3560b7
commit 161a228bd5
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
3 changed files with 32 additions and 21 deletions

View file

@ -81,6 +81,13 @@ in
hasPassword = true;
randomizeMac = true;
}
{
ssid = "LouisaCoffee";
bssid = "fa:92:bf:62:7c:19";
priority = privatePriority;
hasPassword = true;
randomizeMac = true;
}
{
ssid = "MetroTaipei x Louisa"; # 大安
priority = privatePriority;

View file

@ -20,12 +20,13 @@ let
randomizeMac ? false,
...
}:
let
uniqueKey = "${ssid}${lib.optionalString (bssid != null) bssid}";
in
{
${uniqueKey} # we use a unique key here to make sure no "same ssid different bssid" networks collide in key.
=
${
# We use a unique key here to make sure no "same ssid different bssid" networks collide in key.
# This is ordered, we still show "null" so that it would come after hex characters [a-z0-9].
# The serialization is based on string order.
"${ssid},${if bssid != null then bssid else "null"}"
} =
lib.mkMerge [
(builtins.removeAttrs networkArgs [
"hasPassword"
@ -33,7 +34,10 @@ let
"randomizeMac"
])
(lib.optionalAttrs hasPassword {
pskRaw = "ext:${escapePwdKey uniqueKey}"; # this implies changing the external password key if you set a bssid!
pskRaw = "ext:${
# this implies changing the external password key if you set a bssid!
escapePwdKey (if bssid == null then ssid else "${ssid},${bssid}")
}";
})
{
extraConfig = ''

Binary file not shown.