1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 19:23:01 +03:00

quirks/wifi: Add quirk to disable MAC address randomization

This commit is contained in:
Samuel Dionne-Riel 2021-01-10 20:42:36 -05:00
parent ed9da448d7
commit 3a48ed5fa1
2 changed files with 37 additions and 0 deletions

View File

@ -3,5 +3,6 @@
./exynos
./qualcomm
./framebuffer.nix
./wifi.nix
];
}

36
modules/quirks/wifi.nix Normal file
View File

@ -0,0 +1,36 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkOption types mkMerge mkIf;
cfg = config.mobile.quirks;
in
{
options.mobile.quirks.wifi = {
disableMacAddressRandomization = mkOption {
type = types.bool;
default = false;
description = ''
Disables MAC address randomization.
This may be required by some hardware or drivers, or combination.
When the feature is enabled (quirk disabled) it may cause the wifi
interface to disappear when enabled, as long as Network Manager is
active.
'';
};
};
config = mkIf cfg.wifi.disableMacAddressRandomization {
environment.etc."NetworkManager/conf.d/30-mac-randomization.conf" = {
source = pkgs.writeText "30-mac-randomization.conf" ''
[device-mac-randomization]
wifi.scan-rand-mac-address=no
[connection-mac-randomization]
ethernet.cloned-mac-address=preserve
wifi.cloned-mac-address=preserve
'';
target = "NetworkManager/conf.d/30-mac-randomization.conf";
};
};
}