|
18 | 18 | ]; |
19 | 19 |
|
20 | 20 | options.hardware.lenovo.x13s = { |
21 | | - wifiMac = lib.mkOption { |
| 21 | + wifiMAC = lib.mkOption { |
22 | 22 | type = lib.types.nullOr (lib.types.strMatching "([0-9a-f]{2}(:[0-9a-f]{2}){5})"); |
23 | 23 | description = '' |
24 | | - WiFi MAC address to set on boot. When not set a random mac |
| 24 | + Wi-Fi MAC address to set on boot. When not set a random MAC |
25 | 25 | address is assigned. Expects lowercase. |
26 | 26 | ''; |
27 | 27 | default = null; |
28 | 28 | }; |
29 | 29 |
|
30 | | - bluetoothMac = lib.mkOption { |
| 30 | + bluetoothMAC = lib.mkOption { |
31 | 31 | type = lib.types.nullOr (lib.types.strMatching "([0-9A-F]{2}(:[0-9A-F]{2}){5})"); |
32 | 32 | description = '' |
33 | | - Bluetooth MAC address to set on boot. If null, the mac is |
| 33 | + Bluetooth MAC address to set on boot. If null, the MAC is |
34 | 34 | generated using /etc/machine-id to seed the random generator. |
35 | 35 | When not set, bluetooth.service fails to start. Expects |
36 | 36 | upper case. |
|
41 | 41 |
|
42 | 42 | config = lib.mkMerge ([ |
43 | 43 |
|
44 | | - # WiFi |
45 | | - (lib.mkIf (cfg.wifiMac != null) { |
| 44 | + # Wi-Fi |
| 45 | + (lib.mkIf (cfg.wifiMAC != null) { |
46 | 46 | # https://github.com/jhovold/linux/wiki/X13s#wi-fi |
47 | 47 | services.udev.extraRules = builtins.concatStringsSep ", " [ |
48 | 48 | ''ACTION=="add"'' |
49 | 49 | ''SUBSYSTEM=="net"'' |
50 | 50 | ''KERNELS=="0006:01:00.0"'' |
51 | | - ''RUN+="${pkgs.iproute2}/bin/ip link set dev $name address ${cfg.wifiMac}"'' |
| 51 | + ''RUN+="${pkgs.iproute2}/bin/ip link set dev $name address ${cfg.wifiMAC}"'' |
52 | 52 | ]; |
53 | 53 | }) |
54 | 54 |
|
|
63 | 63 | restartIfChanged = false; |
64 | 64 |
|
65 | 65 | script = '' |
66 | | - BLUETOOTH_MAC="${lib.optionalString (cfg.bluetoothMac != null) cfg.bluetoothMac}" |
| 66 | + BLUETOOTH_MAC="${lib.optionalString (cfg.bluetoothMAC != null) cfg.bluetoothMAC}" |
67 | 67 |
|
68 | 68 | if [ "$BLUETOOTH_MAC" = "" ] ; then |
69 | | - echo 'generating bluetooth mac' |
| 69 | + echo 'Generating Bluetooth MAC' |
70 | 70 | # we might be able to use the system serial number but, if we lost machine-id |
71 | 71 | # the system has probably lost the bluetooth device keys anyway |
72 | 72 | SEED=$(( $(cat /etc/machine-id | head -c 128 | sed -e 's/[^0-9]//g;s/^0*//') )) |
|
80 | 80 | # > be constructed by leaving the Group bit zero. |
81 | 81 | # |
82 | 82 | # First, and only argument is for passing a file to seed RANDOM. |
83 | | - # recommend using `/etc/machine-id` to pin the mac address if needed. |
| 83 | + # recommend using `/etc/machine-id` to pin the MAC address if needed. |
84 | 84 | |
85 | 85 | BLUETOOTH_MAC="$(RANDOM=$SEED ; printf '%X%X:%02X:%02X:%02X:%02X:%02X' \ |
86 | 86 | $[RANDOM%16] $[((RANDOM%4)+1)*4-2] \ |
|
95 | 95 | # would like to find a better way to handle this. |
96 | 96 | while ! [ -d /sys/class/bluetooth ] ; do |
97 | 97 | sleep 5 |
98 | | - echo "waiting for bluetooth" |
| 98 | + echo "Waiting for Bluetooth" |
99 | 99 | done |
100 | 100 | sleep 5 |
101 | 101 |
|
102 | | - echo "assigning mac: $BLUETOOTH_MAC" |
| 102 | + echo "Assigning MAC: $BLUETOOTH_MAC" |
103 | 103 | yes | ${config.hardware.bluetooth.package}/bin/btmgmt --index 0 public-addr $BLUETOOTH_MAC |
104 | 104 | ''; |
105 | 105 |
|
|
202 | 202 | } |
203 | 203 | ) |
204 | 204 |
|
205 | | - # grub does not handle device tree yet |
| 205 | + # GRUB does not handle device tree yet |
206 | 206 | (lib.mkIf (config.boot.loader.grub.enable) { |
207 | 207 | warnings = lib.optional ( |
208 | 208 | !config.boot.loader.grub.efiSupport |
|
0 commit comments