-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor platformio fix ide #237313
base: master
Are you sure you want to change the base?
Refactor platformio fix ide #237313
Conversation
I tested the { pkgs ? import /home/jeroen/devel/github.com/ppenguin/nixpkgs {} }:
let
envname = "platformio-fhs";
mypython = pkgs.python3.withPackages (ps: with ps; [ platformio ]);
in
(pkgs.buildFHSUserEnv {
name = envname;
targetPkgs = pkgs: (with pkgs; [
arduino-cli avrdude
platformio-core
mypython
zsh
]);
runScript = "zsh";
}).env The above would use a different python env for For further integration (see above refactoring ideas) I could use some help, since I'm not entirely sure how to correctly handle outputs offering a complete env in the best way (maybe just the current |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-use-platformio-with-vscode/15805/8 |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-build-patched-avr-gcc-with-patched-avr-libc/21468/2 |
Thanks for working on this! I don’t really have the expertise to help land this, but with this patch I can now use platformio with vscode to build a rp2040 project. I had to tweak my shell.nix slightly due to #263201: { pkgs ? import (builtins.fetchTarball {
# NixOS/nixpkgs#237313 = ppenguin:refactor-platformio-fix-ide
url = "https://github.com/NixOS/nixpkgs/archive/3592b10a67b518700002f1577e301d73905704fe.tar.gz";
}) {},
}:
let
envname = "platformio-fhs";
mypython = pkgs.python3.withPackages (ps: with ps; [ platformio ]);
in
(pkgs.buildFHSUserEnv {
name = envname;
targetPkgs = pkgs: (with pkgs; [
platformio-core
mypython
]);
# NixOS/nixpkgs#263201, NixOS/nixpkgs#262775, NixOS/nixpkgs#262080
runScript = "env LD_LIBRARY_PATH= bash";
}).env I’ve updated the wiki in the meantime. |
3592b10
to
70beca8
Compare
@wegank unstale please, this issue needs support; As-is |
Is this pull request still being considered/reviewed? It really sucks not being able to use PIO at all on NixOS |
Yes, but you can use it already, just use this PR for the PIO package, see also the wiki I'm still waiting for one of the original package authors to chime in, since I've currently neither the time nor the skills to land this PR in a consistent way (i.e. using correct passthrough's and what not to make sure both vscode and standalone function uses the same pyenv, a correct FHS, etc.) |
@ppenguin I can not get the example shell to work, is there a way to do this? |
I also could never get it to work, but that could very well be due to my inexperience with Nix. I never asked as I was too nervous and StackOverflow has ruined my confidence in stuff like this. I also never really wanted to use it in a shell, but rather have it so that when I rebuild it simply installs this PR instead of pulling the current version, this is really important to me but I don't understand Nix enough to have implemented it after reading through the documentation on how to implement it like this. My current Nix config is public on my profile if curious |
I made a quick&dirty fix in my env flake: https://github.com/ppenguin/nixenvs/blob/main/dev/devshell-pio-arduino-fhs.nix I'm short on time to do it well, also I haven't really tested it, but Run int like so: #!/usr/bin/env bash
PRJROOT="$(git rev-parse --show-toplevel)"
FLAKE=github:ppenguin/nixenvs
# avoid a "load loop" of direnv when the new fhs env is entered
# https://github.com/direnv/direnv/issues/992
if [ -z "$IN_NIX_SHELL" ]; then
use flake $FLAKE\#pio-arduino-fhs
fi
export PRJROOT |
Description of changes
core.nix
andchrootenv.nix
to use the python module as a dependency, thereby mirroring upstream structure and facilitating fixing the IDE (vscode extension)Rationale
The current
nixpkgs
version does not work with the IDE (vscode
extension), because the extension callspython -m platformio
as executable to interact with the "backend server".The goal would be to have the package
platformio-core
expose both apython
environment with the required modules, most importantlyplatformio
within the env, (possibly also accepting an optional argument for "extra pyPackages" (or just an overriddenpkgs.python3
instance passed in?)) and thepio
executable.This package would then (for the "normal usecase") be instantiated in an FHS
nix-shell
ordevShell
e.g. loaded viadirenv
, and be automatically picked up by a startedvscode
that has theplatformio-ide
extension.Probably the best way to implement this is to have a
platformio
python3
package (already implemented as part of this PR), and use it as a dependecy in the "normal" nix packages. This probably means that most of the "heavy lifting" will only be present in the expression for the python module, and the others would be highly simplified and "just" take care of instantiating their respective environments.Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)