Platformio: Difference between revisions

From NixOS Wiki
imported>Verkackinator
Update udev instruction
imported>Ryan4yin
m fix: adding `pkgs.openocd` to `services.udev.packages`
Line 22: Line 22:
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
{
{
   services.udev.packages = [ pkgs.platformio ];
   services.udev.packages = [  
    pkgs.platformio
    pkgs.openocd
  ];
}
}
</syntaxHighlight>
</syntaxHighlight>
Line 36: Line 39:
}
}
</syntaxHighlight>
</syntaxHighlight>
== See also ==
* [https://github.com/NixOS/nixpkgs/issues/224895 Platformio permission denied[13]]

Revision as of 15:42, 24 July 2023

PlatformIO is a SDK/toolchain manager for various microcontrollers and and embedded platforms i.e. esp32.

Basic development environment

{ pkgs ? import <nixpkgs> {} }:
let
in
  pkgs.mkShell {
    buildInputs = [
      pkgs.platformio
      # optional: needed as a programmer i.e. for esp32
      # pkgs.avrdude
    ];
}

NixOS

Add the required udev rules.

{
  services.udev.packages = [ 
    pkgs.platformio
    pkgs.openocd
  ];
}

Use in vscode

To use the nix-shell provided PlatformIO rather the builtin one first open vscode within the nix-shell and also modify it's settings.json to also contain the following line:

{
      "platformio-ide.useBuiltinPIOCore": false,
}

See also