My personal ZMK CONFIG's for my keyboards.
** Docker:
Distilled from: [[https://zmk.dev/docs/development/setup][ZMK Docs: Toolchain Setup]] and [[https://zmk.dev/docs/development/build-flash][ZMK Docs: Building and Flashing]].
*** Org codeblock to initialise the =zmk= docker container:
echo "- Get ZMK source to mount into container..." git clone https://github.com/zmkfirmware/zmk.git $zmk_path || true cd $zmk_path git pull cd -
echo "- Initialise a Docker Container that will be modified..." docker run --name zmk -v $PWD/$zmk_path/app/:/app -v $PWD:/zmk-config zmkfirmware/zmk-build-arm:stable sleep infinity
docker stop zmk docker start zmk
echo "- Initial setup in the container..." docker exec zmk west init -l /app docker exec zmk west update docker exec zmk west zephyr-export
echo "- Install LSP Server (clangd) for emacs..." docker exec zmk apt-get update docker exec zmk apt-get -y install clangd
*** Org codeblock to build firmware's in the =zmk= docker container:
echo "- Subsequent builds in the container..." docker exec zmk west build -p -s /app -d /app/build/cradio/left/ --board nice_nano -- -DSHIELD=cradio_left -DZMK_CONFIG=/zmk-config/config docker exec zmk west build -p -s /app -d /app/build/cradio/right/ --board nice_nano -- -DSHIELD=cradio_right -DZMK_CONFIG=/zmk-config/config docker exec zmk west build -p -s /app -d /app/build/ferris --board ferris_rev02 -- -DZMK_CONFIG=/zmk-config/config
echo "- Copy files to root of build/ ..." docker exec zmk rm -rf /app/build/.uf2 /app/build/.bin || true docker exec zmk cp /app/build/cradio/left/zephyr/zmk.uf2 /app/build/cradio_left.uf2 docker exec zmk cp /app/build/cradio/right/zephyr/zmk.uf2 /app/build/cradio_right.uf2 docker exec zmk cp /app/build/ferris/zephyr/zmk.bin /app/build/ferris.bin
echo "- SymLink one of the compile_commands.json to satisfy clangd lsp + eglot in emacs..." docker exec zmk ln -sf /app/build/craidio/right/compile_commands.json /zmk-config/.
** flashing:
Pre-reqs:
USB Storage devices (eg. nice!nano):
Mac doesn't auto-mount FAT16 external drives. Therefore:
echo "- Double-tap GND & RST now!!" mkdir -p ~/Downloads/mounted_keyboard echo "- NOTE: hardcoding to /dev/disk4 for my mac." sleep 10; ls -al /dev/disk*; sudo mount -t msdos /dev/disk4 Downloads/mounted_keyboard echo "- Copy .uf2 file to mounted Nice!Nano now."
All: