mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-16 16:11:15 +00:00
networks: implement bssid support
This commit is contained in:
parent
b66c63601f
commit
076a4448e7
3 changed files with 23 additions and 18 deletions
|
|
@ -6,6 +6,7 @@ in
|
|||
[
|
||||
{
|
||||
ssid = "~";
|
||||
bssid = "de:ad:de:ad:d0:d0"; # dead dead dodo
|
||||
priority = preferredPriority;
|
||||
hasPassword = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,31 +13,35 @@ let
|
|||
go =
|
||||
networkArgs@{
|
||||
ssid,
|
||||
bssid ? null,
|
||||
# Custom fields wrapping nixpkgs module options
|
||||
hasPassword ? false,
|
||||
scanOnLowSignal ? false,
|
||||
randomizeMac ? false,
|
||||
...
|
||||
}:
|
||||
let
|
||||
uniqueKey = "${ssid}${lib.optionalString (bssid != null) bssid}";
|
||||
in
|
||||
{
|
||||
${ssid} = lib.mkMerge [
|
||||
(builtins.removeAttrs networkArgs [
|
||||
# We keep ssid, because it overrides the attrset name ssid
|
||||
# "ssid"
|
||||
"hasPassword"
|
||||
"scanOnLowSignal"
|
||||
"randomizeMac"
|
||||
])
|
||||
(lib.optionalAttrs hasPassword {
|
||||
pskRaw = "ext:${escapePwdKey ssid}";
|
||||
})
|
||||
{
|
||||
extraConfig = ''
|
||||
${lib.optionalString scanOnLowSignal "bgscan=\"simple:30:-70:3600\""}
|
||||
${lib.optionalString randomizeMac "mac_addr=1"}
|
||||
'';
|
||||
}
|
||||
];
|
||||
${uniqueKey} # we use a unique key here to make sure no "same ssid different bssid" networks collide in key.
|
||||
=
|
||||
lib.mkMerge [
|
||||
(builtins.removeAttrs networkArgs [
|
||||
"hasPassword"
|
||||
"scanOnLowSignal"
|
||||
"randomizeMac"
|
||||
])
|
||||
(lib.optionalAttrs hasPassword {
|
||||
pskRaw = "ext:${escapePwdKey uniqueKey}"; # this implies changing the external password key if you set a bssid!
|
||||
})
|
||||
{
|
||||
extraConfig = ''
|
||||
${lib.optionalString scanOnLowSignal "bgscan=\"simple:30:-70:3600\""}
|
||||
${lib.optionalString randomizeMac "mac_addr=1"}
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
in
|
||||
ns: lib.mkMerge (map go ns)
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue