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