Platformio: Difference between revisions

m remaining mardown formatting code
Mach50 (talk | contribs)
m Update the udev rules as per latest error messages from platformio. Use the `with pkgs;` nix style
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
== Basic development environment ==
== Basic development environment ==


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


== NixOS ==
== NixOS ==
Line 20: Line 20:
Add the required udev rules.
Add the required udev rules.


<syntaxHighlight lang=nix>
<syntaxhighlight lang="nix">
{
{
   services.udev.packages = [  
   services.udev.packages = with pkgs; [  
     pkgs.platformio-core
     platformio-core.udev
     pkgs.openocd
     openocd
   ];
   ];
}
}
</syntaxHighlight>
</syntaxhighlight>


== Use in vscode ==
== Use in vscode ==
Line 53: Line 53:
# https://github.com/direnv/direnv/issues/992
# https://github.com/direnv/direnv/issues/992
if [ -z "$IN_NIX_SHELL" ]; then
if [ -z "$IN_NIX_SHELL" ]; then
use flake $FLAKE\#pio-arduino-fhs
    use flake $FLAKE\#pio-arduino-fhs
fi
fi