How to use platformio with vscode

Here is how to run platformio and build an esp32 firmware

  1. create a nix shell

shell.nix

{ pkgs ? import <nixpkgs> {} }:
let
in
  pkgs.mkShell {
    buildInputs = [
      pkgs.platformio
      pkgs.avrdude
    ];
}
  1. open the shell
nix-shell
  1. Open vscode inside the shell
code .
  1. tell vscode to not use the built-in platformio in settings.json
    "platformio-ide.useBuiltinPIOCore": false,

and thats it !
at least thats what worked for me after scratching my head for 3hours on this …
i hope it will help someone else <3

3 Likes

transformed into a wiki article: Platformio - NixOS Wiki

2 Likes

Unfortunately, this is no longer possible (at least it seems not to work in my case) in platformio-vscode-ide version >=2.0.0. The previous versions were executing the platformio scripts directly, while the newer versions are executing the platformio Python module which is not exported from the platformio derivation outputs hidden behind buildFHSUserEnv; see platformio-node-helpers/core.js at 8fac63be73be40589cb006ab0f71cfe7e0b53835 · platformio/platformio-node-helpers · GitHub and platformio-node-helpers/core.js at c59068bb37d24ff3af0ff8adf138eeed89803a37 · platformio/platformio-node-helpers · GitHub

Help would be appreciated.

I have the same problem @rychly :frowning:

Hosted by Flying Circus.