lilyinstarlight / zmk-nix

Build system and configuration files for generating and building ZMK firmware with Nix
MIT License
71 stars 19 forks source link

build fails for custom boards #97

Closed anpin closed 4 months ago

anpin commented 4 months ago

Hi thank a lot for this repo, makes it trivial to bootstrap local zmk environment.

I have an issue compiling firmware with a custom shield located in the config repo. This same config builds just fine using default zmk gh action. My repo is located here https://github.com/anpin/zmk-config/

> tree
.
├── boards
│   └── shields
│       └── riry58
│           ├── boards
│           │   ├── nice_nano.overlay
│           │   └── nice_nano_v2.overlay
│           ├── Kconfig.defconfig
│           ├── Kconfig.shield
│           ├── readme.md
│           ├── riry58.conf
│           ├── riry58.dtsi
│           ├── riry58.keymap
│           ├── riry58_left.conf
│           ├── riry58_left.overlay
│           ├── riry58_right.conf
│           ├── riry58_right.overlay
│           └── riry58.zmk.yml
├── build.yaml
├── config
│   ├── flake_west.yml
│   ├── riry58.conf
│   ├── riry58.keymap
│   └── west.yml
├── flake.lock
├── flake.nix
├── LICENSE
└── zephyr
    └── module.yml

7 directories, 22 files

> nix build -L
...
firmware-left> Running phase: configurePhase
firmware-right> Running phase: patchPhase
firmware-right> Running phase: updateAutotoolsGnuConfigScriptsPhase
firmware-right> Running phase: configurePhase
firmware-left> evaling implicit 'preConfigure' string hook
firmware-left> calling 'preConfigure' function hook '_multioutConfig'
firmware-right> evaling implicit 'preConfigure' string hook
firmware-right> calling 'preConfigure' function hook '_multioutConfig'
firmware-left> -- west build: generating a build system
firmware-right> -- west build: generating a build system
firmware-left> Loading Zephyr default modules (Zephyr base).
firmware-left> -- Application: /build/source/zmk/app
firmware-left> -- CMake version: 3.29.6
firmware-right> Loading Zephyr default modules (Zephyr base).
firmware-right> -- Application: /build/source/zmk/app
firmware-right> -- CMake version: 3.29.6
firmware-left> -- Found Python3: /nix/store/gjkc81dkm1vdr86plm20rhzd309kgbfb-python3-3.12.4-env/bin/python3.12 (found suitable version "3.12.4", minimum required is "3.8") found components: Interpreter
firmware-right> -- Found Python3: /nix/store/gjkc81dkm1vdr86plm20rhzd309kgbfb-python3-3.12.4-env/bin/python3.12 (found suitable version "3.12.4", minimum required is "3.8") found components: Interpreter
firmware-left> -- Cache files will be written to: /build/source/zephyr/.cache
firmware-left> -- Zephyr version: 3.5.0 (/build/source/zephyr), build: 87fa801c5b91f13599358c003bdcafaa54e3543c
firmware-right> -- Cache files will be written to: /build/source/zephyr/.cache
firmware-right> -- Zephyr version: 3.5.0 (/build/source/zephyr), build: 87fa801c5b91f13599358c003bdcafaa54e3543c
firmware-left> -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
firmware-right> -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
firmware-left> -- ZMK Config directory: /build/source/config
firmware-left> -- ZMK Config Kconfig: /build/source/config/riry58.conf
firmware-left> -- Using keymap file: /build/source/config/riry58.keymap
firmware-right> -- ZMK Config directory: /build/source/config
firmware-right> -- ZMK Config Kconfig: /build/source/config/riry58.conf
firmware-right> -- Using keymap file: /build/source/config/riry58.keymap
firmware-left> -- Board: nice_nano_v2
firmware-left> -- Shield(s): riry58_left
firmware-right> -- Board: nice_nano_v2
firmware-right> -- Shield(s): riry58_right
firmware-left> No shield named 'riry58_left' found
firmware-left> Please choose from among the following shields:
<--- list of shields here --->
firmware-left> CMake Error at /build/source/zephyr/cmake/modules/shields.cmake:140 (message):
firmware-left>   Invalid SHIELD; see above.
firmware-left> Call Stack (most recent call first):
firmware-left>   /build/source/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
firmware-left>   /build/source/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
firmware-left>   /build/source/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
firmware-left>   CMakeLists.txt:8 (find_package)
firmware-left>
firmware-left> -- Configuring incomplete, errors occurred!
firmware-left> FATAL ERROR: command exited with status 1: /nix/store/ll2b6cslly4v30im7qk34f9y21ziiz1i-cmake-3.29.6/bin/cmake -DWEST_PYTHON=/nix/store/gjkc81dkm1vdr86plm20rhzd309kgbfb-python3-3.12.4-env/bin/python3.12 -B/build/source/build -GNinja -DBOARD=nice_nano_v2 -DSHIELD=riry58_left -DBUILD_VERSION=87fa801c5b91f13599358c003bdcafaa54e3543c -DZMK_CONFIG=/build/source/config -S/build/source/zmk/app
firmware-right> No shield named 'riry58_right' found
firmware-right> Please choose from among the following shields:
<--- list of shields here --->
firmware-right> CMake Error at /build/source/zephyr/cmake/modules/shields.cmake:140 (message):
firmware-right>   Invalid SHIELD; see above.
firmware-right> Call Stack (most recent call first):
firmware-right>   /build/source/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
firmware-right>   /build/source/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
firmware-right>   /build/source/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
firmware-right>   CMakeLists.txt:8 (find_package)
firmware-right>
firmware-right> -- Configuring incomplete, errors occurred!
firmware-right> FATAL ERROR: command exited with status 1: /nix/store/ll2b6cslly4v30im7qk34f9y21ziiz1i-cmake-3.29.6/bin/cmake -DWEST_PYTHON=/nix/store/gjkc81dkm1vdr86plm20rhzd309kgbfb-python3-3.12.4-env/bin/python3.12 -B/build/source/build -GNinja -DBOARD=nice_nano_v2 -DSHIELD=riry58_right -DBUILD_VERSION=87fa801c5b91f13599358c003bdcafaa54e3543c -DZMK_CONFIG=/build/source/config -S/build/source/zmk/app
firmware-left>
error: builder for '/nix/store/lq9lj2z9ppviixnv327zdpd51n8a7zvc-firmware-left.drv' failed with exit code 1;
       last 10 log lines:
       > Call Stack (most recent call first):
       >   /build/source/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
       >   /build/source/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
       >   /build/source/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
       >   CMakeLists.txt:8 (find_package)
       >
       >
       > -- Configuring incomplete, errors occurred!
       > FATAL ERROR: command exited with status 1: /nix/store/ll2b6cslly4v30im7qk34f9y21ziiz1i-cmake-3.29.6/bin/cmake -DWEST_PYTHON=/nix/store/gjkc81dkm1vdr86plm20rhzd309kgbfb-python3-3.12.4-env/bin/python3.12 -B/build/source/build -GNinja -DBOARD=nice_nano_v2 -DSHIELD=riry58_left -DBUILD_VERSION=87fa801c5b91f13599358c003bdcafaa54e3543c -DZMK_CONFIG=/build/source/config -S/build/source/zmk/app
       >
       For full logs, run 'nix log /nix/store/lq9lj2z9ppviixnv327zdpd51n8a7zvc-firmware-left.drv'.
error: 1 dependencies of derivation '/nix/store/cnnsf1i09picxi7qjbpkp6nnaxf2mwib-firmware.drv' failed to build
RANKSHANK commented 4 months ago

It's working for me with my dactyl, I do just use the provided nix run .#flash though

You may need to add the extra file extensions required to declare your custom board to the src declaration of the flake's firmware package, see the changes I made to my copy here

lilyinstarlight commented 4 months ago

I'm gonna add those extra extensions by default too. Feel free to PR it if y'all can get to it before I get to my computer later today