Skip to content

xdadrm/nixos_use_platformio_patformio-ide_and_vscode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

User Guide: Portable PlatformIO Development Environment with VSCodium

Summary

This guide outlines the steps necessary to set up a portable PlatformIO development environment using VSCodium on NixOS or other Nix-based systems. The configuration relies on nixpkgs for Python and PlatformIO, bypassing versions provided by the PlatformIO extension. This setup involves patching the PlatformIO VSCode extension to ensure compatibility.

Warning: This method is dependent on a work-in-progress pull request and modifies packages from the Visual Studio Marketplace. Consequently, it may break in the future.

Usage

The quickest way to use this flake to work on a platformio project:

  1. Go to your project repo
  2. Enter the devshell:
    nix develop github:xdadrm/nixos_use_platformio_patformio-ide_and_vscode
    
  3. codium .

Modify devshell

If you need to modify something in the devshell:

  1. Clone the repository containing the flake.nix file.
  2. Run nix develop --build.
  3. Launch VSCodium using the provided codium function within the shell (Note: pio is also available and working).
git clone https://github.com/xdadrm/nixos_use_platformio_patformio-ide_and_vscode.git
cd nixos_use_platformio_patformio-ide_and_vscode
nix develop --build
codium .

Detailed Guide

Prerequisites

Setup Instructions

1. Clone the Repository

Clone the repository containing the flake.nix file to your local machine:

git clone <repository-url>
cd <repository-directory>

2. Enter the Development Shell

Use the following command to enter the development shell, which provides all the necessary tools (PlatformIO, Python, VSCodium, and Git):

nix develop --build

3. Launch VSCodium

After running the setup script, you can launch VSCodium with the following command:

codium

This command ensures that VSCodium uses the custom settings and the patched PlatformIO extension.

4. (Optional) Customize Environment Variables

You can customize the following environment variables:

  • PLATFORMIO_CORE_DIR: Specifies the directory for PlatformIO core files (default: $PWD/.platformio).
  • VSCODE_DATA_DIR: Specifies the directory for VSCodium user data (default: $PWD/.vscode-data).

For example:

export PLATFORMIO_CORE_DIR=/path/to/custom/platformio
export VSCODE_DATA_DIR=/path/to/custom/vscode-data

Conclusion

This setup provides a portable, reproducible, and customizable PlatformIO development environment using VSCodium. By leveraging Nix, you can ensure that your development environment is consistent across different machines and projects.

For more details, refer to the flake.nix file and its associated functions (platformioEnv, patchedExtension, vscodiumSettings, and setupScript).

Credits

This guide builds upon ppenguin's PR-237313 along with delan's approach documented in the wiki: PlatformIO Nix Wiki.

About

A flake that allows using platformio, platform-ide ,vscode on nixos

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages