Skip to content

Commit 1e14ebf

Browse files
l2 hostapd.nix
1 parent 5d74a92 commit 1e14ebf

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed

desktop/l/home.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,8 @@
395395
#cmake
396396
pkg-config
397397

398+
gdb
399+
398400
# Scripting/Utils
399401
perl
400402
#3.12.8 on 12th of Feb 2025

desktop/l2/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ rebuild_trace:
3333
update:
3434
sudo nix flake update;
3535

36+
sync:
37+
rsync -av /home/das/nixos/desktop/"${EXPECTED_HOSTNAME}"/ "${EXPECTED_HOSTNAME}":/home/das/nixos/desktop/"${EXPECTED_HOSTNAME}"/
38+
#rsync -av /home/das/nixos/modules/ hp1:/home/das/nixos/modules/
39+
3640
rebuild_old:
3741
# sudo cp ./flake.nix /etc/nixos/
3842
# sudo cp ./flake.lock /etc/nixos/

desktop/l2/configuration.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#./smokeping.nix
4242
#./distributed-builds.nix
4343
./hyprland.nix
44+
./hostapd.nix
4445
];
4546

4647
boot = {

desktop/l2/hostapd.nix

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#
2+
# hostapd.nix
3+
#
4+
5+
{ config, pkgs, ... }:
6+
7+
let
8+
interface1 = "wlp35s0"; # e.g. 2.4GHz channel 6
9+
interface2 = "wlp65s0"; # e.g. 5GHz channel 100
10+
interface3 = "wlp70s0"; # e.g. 5GHz channel 149
11+
12+
commonHostapdSettings = ''
13+
ssid=myssid
14+
wpa=2
15+
wpa_key_mgmt=SAE
16+
rsn_pairwise=CCMP
17+
sae_require_mfp=1
18+
ieee80211w=2
19+
ieee80211n=1
20+
ieee80211ac=1
21+
ieee80211ax=1
22+
wmm_enabled=1
23+
24+
# WMM tuning for Best Effort (AC_BE)
25+
wmm_ac_be_aifs=1
26+
wmm_ac_be_cwmin=4
27+
wmm_ac_be_cwmax=4
28+
wmm_ac_be_txop_limit=32
29+
wmm_ac_be_acm=0
30+
31+
# 802.11r (Fast BSS Transition)
32+
ieee80211r=1
33+
mobility_domain=4f57
34+
ft_over_ds=1
35+
ft_psk_generate_local=1
36+
nas_identifier=myssid-ap
37+
'';
38+
in
39+
{
40+
services.hostapd = {
41+
enable = true;
42+
radios = {
43+
"${interface1}" = {
44+
config = pkgs.writeText "hostapd-1.conf" (''
45+
interface=${interface1}
46+
hw_mode=g
47+
channel=6
48+
${commonHostapdSettings}
49+
'');
50+
};
51+
"${interface2}" = {
52+
config = pkgs.writeText "hostapd-2.conf" (''
53+
interface=${interface2}
54+
hw_mode=a
55+
channel=100
56+
${commonHostapdSettings}
57+
'');
58+
};
59+
"${interface3}" = {
60+
config = pkgs.writeText "hostapd-3.conf" (''
61+
interface=${interface3}
62+
hw_mode=a
63+
channel=149
64+
${commonHostapdSettings}
65+
'');
66+
};
67+
};
68+
};
69+
70+
# Disable DHCP on all interfaces, use static IP or bridge later
71+
networking.interfaces.${interface1}.useDHCP = false;
72+
networking.interfaces.${interface2}.useDHCP = false;
73+
networking.interfaces.${interface3}.useDHCP = false;
74+
75+
networking.interfaces.${interface1}.ipv4.addresses = [ { address = "192.168.30.1"; prefixLength = 24; } ];
76+
networking.interfaces.${interface2}.ipv4.addresses = [ { address = "192.168.31.1"; prefixLength = 24; } ];
77+
networking.interfaces.${interface3}.ipv4.addresses = [ { address = "192.168.32.1"; prefixLength = 24; } ];
78+
79+
networking.firewall.enable = true;
80+
networking.nat.enable = true;
81+
networking.nat.externalInterface = "enp1s0";
82+
}

0 commit comments

Comments
 (0)