about summary refs log tree commit diff
path: root/pkgs/development/arduino
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/arduino')
-rw-r--r--pkgs/development/arduino/platformio/chrootenv.nix41
-rw-r--r--pkgs/development/arduino/platformio/core.nix30
-rw-r--r--pkgs/development/arduino/platformio/fix-searchpath.patch11
3 files changed, 70 insertions, 12 deletions
diff --git a/pkgs/development/arduino/platformio/chrootenv.nix b/pkgs/development/arduino/platformio/chrootenv.nix
index 69182c3aa0d8..f46e705fb901 100644
--- a/pkgs/development/arduino/platformio/chrootenv.nix
+++ b/pkgs/development/arduino/platformio/chrootenv.nix
@@ -1,23 +1,40 @@
-{ stdenv, lib, buildFHSUserEnv
-}:
+{ lib, buildFHSUserEnv }:
+
 let
-  pio-pkgs = pkgs: (with pkgs;
-    [
-      python27Packages.python
-      python27Packages.setuptools
-      python27Packages.pip
-      python27Packages.bottle
-      python27Packages.platformio
+  pio-pkgs = pkgs:
+    let
+      python = pkgs.python.override {
+        packageOverrides = self: super: {
+
+          # https://github.com/platformio/platformio-core/issues/349
+          click = super.click.overridePythonAttrs (oldAttrs: rec {
+            version = "5.1";
+            src = oldAttrs.src.override {
+              inherit version;
+              sha256 = "678c98275431fad324275dec63791e4a17558b40e5a110e20a82866139a85a5a";
+            };
+          });
+
+          platformio = self.callPackage ./core.nix { };
+        };
+      };
+    in (with pkgs; [
       zlib
+    ]) ++ (with python.pkgs; [
+      python
+      setuptools
+      pip
+      bottle
+      platformio
     ]);
-in
-buildFHSUserEnv {
+
+in buildFHSUserEnv {
   name = "platformio";
 
   targetPkgs = pio-pkgs;
   multiPkgs = pio-pkgs;
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "An open source ecosystem for IoT development";
     homepage = http://platformio.org;
     maintainers = with maintainers; [ mog ];
diff --git a/pkgs/development/arduino/platformio/core.nix b/pkgs/development/arduino/platformio/core.nix
new file mode 100644
index 000000000000..9d30c2268554
--- /dev/null
+++ b/pkgs/development/arduino/platformio/core.nix
@@ -0,0 +1,30 @@
+{ stdenv, buildPythonPackage, fetchPypi
+, bottle, click, colorama
+, lockfile, pyserial, requests
+, semantic-version
+, git
+}:
+
+buildPythonPackage rec {
+  pname = "platformio";
+  version = "3.5.2";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "bb311ce5b8f12c95bc45c2071626a4887a3632fb2472b4d69a873b2acfc2e4ec";
+  };
+
+  propagatedBuildInputs =  [
+    bottle click colorama git lockfile
+    pyserial requests semantic-version
+  ];
+
+  patches = [ ./fix-searchpath.patch ];
+
+  meta = with stdenv.lib; {
+    description = "An open source ecosystem for IoT development";
+    homepage = http://platformio.org;
+    maintainers = with maintainers; [ mog makefu ];
+    license = licenses.asl20;
+  };
+}
diff --git a/pkgs/development/arduino/platformio/fix-searchpath.patch b/pkgs/development/arduino/platformio/fix-searchpath.patch
new file mode 100644
index 000000000000..a215ffc7d614
--- /dev/null
+++ b/pkgs/development/arduino/platformio/fix-searchpath.patch
@@ -0,0 +1,11 @@
+--- ./platformio/util.py-old	2017-09-29 01:20:08.174548250 +0200
++++ ./platformio/util.py	2017-09-29 01:19:48.410485308 +0200
+@@ -395,7 +395,7 @@
+                 isdir(join(p, "click")) or isdir(join(p, "platformio")))
+         if all(conditions):
+             _PYTHONPATH.append(p)
+-    os.environ['PYTHONPATH'] = os.pathsep.join(_PYTHONPATH)
++    os.environ['PYTHONPATH'] = os.pathsep.join(sys.path)
+ 
+ 
+ def get_serialports(filter_hwid=False):