turris.nix (2920B)
1 { 2 config, 3 pkgs, 4 lim, 5 ... 6 }: 7 let 8 svc = config.system.service; 9 10 in 11 rec { 12 imports = [ 13 ../modules/network 14 ../modules/ssh 15 ../modules/vlan 16 ../modules/wlan.nix 17 ../modules/hostapd 18 ../modules/bridge 19 ../modules/dhcp4c 20 21 ../modules/outputs/ext4fs.nix 22 ../modules/outputs/tftpboot.nix 23 ]; 24 25 rootfsType = "ext4"; 26 27 boot.tftp = { 28 # IP addresses to use in the boot monitor when flashing/ booting 29 # over TFTP. If you are flashing using the stock firmware's Web UI 30 # then these dummy values are fine 31 ipaddr = "10.0.0.8"; # my address 32 serverip = "10.0.0.1"; # build machine or other tftp server 33 # loadAddress = lim.parseInt "0x40000800"; 34 }; 35 36 hostname = "omnia"; 37 38 services.hostap = 39 let 40 secrets = { 41 ssid = "not-the-internet"; 42 channel = 4; 43 wpa_passphrase = "diamond dogs"; 44 }; 45 in 46 svc.hostapd.build { 47 interface = config.hardware.networkInterfaces.wlan; 48 params = { 49 country_code = "GB"; 50 hw_mode = "g"; 51 wmm_enabled = 1; 52 ieee80211n = 1; 53 inherit (secrets) ssid channel wpa_passphrase; 54 auth_algs = 1; # 1=wpa2, 2=wep, 3=both 55 wpa = 2; # 1=wpa, 2=wpa2, 3=both 56 wpa_key_mgmt = "WPA-PSK"; 57 wpa_pairwise = "TKIP CCMP"; # auth for wpa (may not need this?) 58 rsn_pairwise = "CCMP"; # auth for wpa2 59 }; 60 }; 61 62 services.hostap5 = 63 let 64 secrets = { 65 ssid = "not-the-internet"; 66 channel = 36; 67 wpa_passphrase = "diamond dogs"; 68 }; 69 in 70 svc.hostapd.build { 71 interface = config.hardware.networkInterfaces.wlan5; 72 params = { 73 country_code = "GB"; 74 hw_mode = "a"; 75 76 ht_capab = "[HT40+]"; 77 vht_oper_chwidth = 1; 78 vht_oper_centr_freq_seg0_idx = secrets.channel + 6; 79 ieee80211ac = 1; 80 81 wmm_enabled = 1; 82 inherit (secrets) ssid channel wpa_passphrase; 83 auth_algs = 1; # 1=wpa2, 2=wep, 3=both 84 wpa = 2; # 1=wpa, 2=wpa2, 3=both 85 wpa_key_mgmt = "WPA-PSK"; 86 wpa_pairwise = "TKIP CCMP"; # auth for wpa (may not need this?) 87 rsn_pairwise = "CCMP"; # auth for wpa2 88 }; 89 }; 90 91 services.int = svc.bridge.primary.build { 92 ifname = "int"; 93 }; 94 95 services.dhcpc = svc.dhcp4c.client.build { 96 interface = services.int; 97 dependencies = [ config.services.hostname ]; 98 }; 99 100 services.bridge = svc.bridge.members.build { 101 primary = services.int; 102 members = with config.hardware.networkInterfaces; [ 103 lan 104 wlan 105 ]; 106 }; 107 108 services.sshd = svc.ssh.build { }; 109 110 users.root = { 111 # the password is "secret". Use mkpasswd -m sha512crypt to 112 # create this hashed password string 113 passwd = "$6$y7WZ5hM6l5nriLmo$5AJlmzQZ6WA.7uBC7S8L4o19ESR28Dg25v64/vDvvCN01Ms9QoHeGByj8lGlJ4/b.dbwR9Hq2KXurSnLigt1W1"; 114 }; 115 116 defaultProfile.packages = with pkgs; [ 117 figlet 118 pciutils 119 ]; 120 }