diff --git a/pkgs/development/arduino/platformio/chrootenv.nix b/pkgs/development/arduino/platformio/chrootenv.nix index 01a2fb873aa2..62a1d190a00a 100644 --- a/pkgs/development/arduino/platformio/chrootenv.nix +++ b/pkgs/development/arduino/platformio/chrootenv.nix @@ -1,4 +1,4 @@ -{ lib, buildFHSUserEnv }: +{ lib, buildFHSUserEnv, fetchFromGitHub }: let pio-pkgs = pkgs: @@ -19,6 +19,14 @@ let platformio ]); + src = fetchFromGitHub { + owner = "platformio"; + repo = "platformio-core"; + rev = "v4.3.4"; + sha256 = "0vf2j79319ypr4yrdmx84853igkb188sjfvlxgw06rlsvsm3kacq"; + }; + + in buildFHSUserEnv { name = "platformio"; @@ -34,7 +42,10 @@ in buildFHSUserEnv { }; extraInstallCommands = '' + mkdir -p $out/lib/udev/rules.d + ln -s $out/bin/platformio $out/bin/pio + ln -s ${src}/scripts/99-platformio-udev.rules $out/lib/udev/rules.d/99-platformio-udev.rules ''; runScript = "platformio"; diff --git a/pkgs/development/arduino/platformio/core.nix b/pkgs/development/arduino/platformio/core.nix index d83013dbbde5..891d613da512 100644 --- a/pkgs/development/arduino/platformio/core.nix +++ b/pkgs/development/arduino/platformio/core.nix @@ -82,6 +82,7 @@ in buildPythonApplication rec { patches = [ ./fix-searchpath.patch ./use-local-spdx-license-list.patch + ./missing-udev-rules-nixos.patch ]; postPatch = '' diff --git a/pkgs/development/arduino/platformio/missing-udev-rules-nixos.patch b/pkgs/development/arduino/platformio/missing-udev-rules-nixos.patch new file mode 100644 index 000000000000..f29b93cef4d0 --- /dev/null +++ b/pkgs/development/arduino/platformio/missing-udev-rules-nixos.patch @@ -0,0 +1,14 @@ +diff --git a/platformio/exception.py b/platformio/exception.py +index d291ad7f..4761a35b 100644 +--- a/platformio/exception.py ++++ b/platformio/exception.py +@@ -195,7 +195,8 @@ class MissedUdevRules(InvalidUdevRules): + + MESSAGE = ( + "Warning! Please install `99-platformio-udev.rules`. \nMode details: " +- "https://docs.platformio.org/en/latest/faq.html#platformio-udev-rules" ++ "https://docs.platformio.org/en/latest/faq.html#platformio-udev-rules\n" ++ "On NixOS add the platformio package to services.udev.packages" + ) + +