How to build ZMK firmwares with custom shields locally
I want to move away from microslops github and want to build ZMK-firmwares for my keyboards locally. As I found it confusing to add custom shields to the local toolchain, I wrote the following tutorial.
- Install urobs ZMK toolchain
- make sure to use bash, for me the direnv did not work with zsh
- for me nix-direnv gave permission errors so I
chowned the/nix/var/nixto my username recursively. - there are multiple options to add custom shields
- Put everything in your local tree (Not reccomended, but the easiest)
- put all the shield defining files (
.overlay, etc) inzmk/app/boards/shields/$YOURSHIELD - build with
just build $SHIELDNAME. - However this has the disadvantage, that your files will be overwritten when you do a
just update
- put all the shield defining files (
- Manage your shield as an external west module (Recommended but more annoying)
- create your zmk files from the unified zmk config template into a directory
$DIR - build your firmware with
west build -p -s zmk/app -b $BOARD_NAME -- -DZMK_EXTRA_MODULES="$ABSOLUTE_PATH_TO_$DIR" -DSHIELD=$SHIELD_NAME, where in my case$BOARD_NAMEisnice_nano_v2and$SHIELD_NAMEisendgame
- create your zmk files from the unified zmk config template into a directory
- Put everything in your local tree (Not reccomended, but the easiest)