NixOS Linux - Unable to resolve configuration with compilerPath

Hello there,
I just wanted to tinker with my Arduino as I have build something.

I always used the Arduino IDE and now I wanted to use VS Code and the PlatformIO extension.

I’ve generated the default Arduino project for Arduino Uno and I’m getting this error and it won’t build.

Unable to resolve configuration with compilerPath "/home/user/.platformio/packages/toolchain-atmelavr/bin/avr-gcc". Using "/etc/profiles/per-user/user/bin/gcc" instead.

When building I get this:

Processing uno (platform: atmelavr; board: uno; framework: arduino)
---------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR (5.1.0) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.2.0 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/uno/src/main.cpp.o
Archiving .pio/build/uno/libFrameworkArduinoVariant.a
Could not start dynamically linked executable: avr-g++
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld
Could not start dynamically linked executable: avr-gcc-ar
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld
Compiling .pio/build/uno/FrameworkArduino/CDC.cpp.o
*** [.pio/build/uno/src/main.cpp.o] Error 127
*** [.pio/build/uno/libFrameworkArduinoVariant.a] Error 127
Could not start dynamically linked executable: avr-g++
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld
*** [.pio/build/uno/FrameworkArduino/CDC.cpp.o] Error 127

Found the Solution, I use NixOS and I’ve added this to my config:

programs.nix-ld.enable = true;
1 Like