mirror of
https://github.com/NixVegas/badge.git
synced 2026-07-17 05:21:10 -07:00
Rebuild the world at DEF CON with the Nix Badge
- Zig 41.2%
- C 39.8%
- Nix 9.7%
- Shell 4.5%
- CMake 3.9%
- Other 0.9%
|
|
||
|---|---|---|
| pkgs/nixbadge | ||
| src | ||
| .gitignore | ||
| COPYING.md | ||
| default.nix | ||
| flake.lock | ||
| flake.nix | ||
| README.md | ||
| shell.nix | ||
Nix Badge
Hardware features:
- 12x WS2812 LEDs connected to IO14 (with a pleasant RGB fade pattern from the RMT)
- Button connected to IO3
- Status LED connected to IO15
- SDET (SD Detect) pin to IO8
- VSEL2 pin (VSEL / 2) to IO2 (used for reading battery level over ADC)
- Serial obviously works over USB
Known issues
The SD card has 3v3 and GND wired backwards on v1.0 of the badge hardware. It may kill your SD card. There's no fix for this badge that doesn't involve cutting and soldering wires. :-(
Build
nix build ^*ornix-build(note that the^*will produce all outputs, as opposed tonix buildwhich only produces the firmware)./result-flash/bin/flash -p /dev/ttyACM0./result-flash/bin/console -p /dev/ttyACM0(this is just a wrapper aroundidf.py monitor, and you can press ^] to exit)
Development
nix developornix-shell- This will automatically configure the project as a shellHook, creating
sdkconfig, and drop you intosrc
- This will automatically configure the project as a shellHook, creating
- Make some changes
idf.py -p /dev/ttyACM0 build flash monitor- Press ^] to exit
Starting the badge mesh
Hold the button while booted. Default network is NixBadge_XXXXXX, password is 12345678.
Substituting over the mesh
- Connect to the wifi network listed above. You will be assigned a DHCP address.
nix-shell --option substituters http://192.168.5.1:1008 -p hello(just set the last octet to 1)
Sadly, it won't be cached because the SD slot is borked. It's also pretty slow. By default, it connects to the NixVegas wifi for an upstream and substitutes from https://cache.nixos.lv.
You can use the badge as a generic router, too. It will also be slow.
Automated testing
Looks like Espressif has a test harness using pytest. Soon?