about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/arduino
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/arduino')
-rw-r--r--nixpkgs/pkgs/development/arduino/arduino-cli/default.nix46
-rw-r--r--nixpkgs/pkgs/development/arduino/arduino-core/default.nix44
-rw-r--r--nixpkgs/pkgs/development/arduino/platformio/chrootenv.nix13
-rw-r--r--nixpkgs/pkgs/development/arduino/platformio/core.nix57
-rw-r--r--nixpkgs/pkgs/development/arduino/platformio/missing-udev-rules-nixos.patch12
-rw-r--r--nixpkgs/pkgs/development/arduino/platformio/use-local-spdx-license-list.patch13
6 files changed, 135 insertions, 50 deletions
diff --git a/nixpkgs/pkgs/development/arduino/arduino-cli/default.nix b/nixpkgs/pkgs/development/arduino/arduino-cli/default.nix
new file mode 100644
index 000000000000..1b1116a74b5d
--- /dev/null
+++ b/nixpkgs/pkgs/development/arduino/arduino-cli/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, buildGoModule, fetchFromGitHub, buildFHSUserEnv }:
+
+let
+
+  pkg = buildGoModule rec {
+    pname = "arduino-cli";
+    version = "0.12.1";
+
+    src = fetchFromGitHub {
+      owner = "arduino";
+      repo = pname;
+      rev = version;
+      sha256 = "1jlxs4szss2250zp8rz4bislgnzvqhxyp6z48dhx7zaam03hyf0w";
+    };
+
+    subPackages = [ "." ];
+
+    vendorSha256 = "03yj2iar63qm10fw3jh9fvz57c2sqcmngb0mj5jkhbnwf8nl7mhc";
+
+    doCheck = false;
+
+    buildFlagsArray = [
+      "-ldflags=-s -w -X github.com/arduino/arduino-cli/version.versionString=${version} -X github.com/arduino/arduino-cli/version.commit=unknown"
+    ] ++ stdenv.lib.optionals stdenv.isLinux [ "-extldflags '-static'" ];
+
+    meta = with stdenv.lib; {
+      inherit (src.meta) homepage;
+      description = "Arduino from the command line";
+      license = licenses.gpl3Only;
+      maintainers = with maintainers; [ ryantm ];
+    };
+
+  };
+
+# buildFHSUserEnv is needed because the arduino-cli downloads compiler
+# toolchains from the internet that have their interpreters pointed at
+# /lib64/ld-linux-x86-64.so.2
+in buildFHSUserEnv {
+  inherit (pkg) name meta;
+
+  runScript = "${pkg.outPath}/bin/arduino-cli";
+
+  extraInstallCommands = ''
+    mv $out/bin/$name $out/bin/arduino-cli
+  '';
+}
diff --git a/nixpkgs/pkgs/development/arduino/arduino-core/default.nix b/nixpkgs/pkgs/development/arduino/arduino-core/default.nix
index 2a7387c4378a..1c537edd0b42 100644
--- a/nixpkgs/pkgs/development/arduino/arduino-core/default.nix
+++ b/nixpkgs/pkgs/development/arduino/arduino-core/default.nix
@@ -68,13 +68,14 @@ let
     xorg.libXxf86vm
     zlib
   ];
-  teensy_architecture =
-    lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") "linux64"
-    + lib.optionalString (stdenv.hostPlatform.system == "i686-linux") "linux32"
-    + lib.optionalString (stdenv.hostPlatform.system == "aarch64-linux") "linuxaarch64"
-    + lib.optionalString (builtins.match "armv[67]l-linux" stdenv.hostPlatform.system != null) "linuxarm";
-  flavor = ( if withTeensyduino then "teensyduino" else "arduino")
-    + stdenv.lib.optionalString (!withGui) "-core";
+  teensy_architecture = if stdenv.hostPlatform.isx86_32 then "linux32"
+                        else if stdenv.hostPlatform.isx86_64 then "linux64"
+                        else if stdenv.hostPlatform.isAarch64 then "linuxaarch64"
+                        else if stdenv.hostPlatform.isAarch32 then "linuxarm"
+                        else throw "${stdenv.hostPlatform.system} is not supported in teensy";
+
+  flavor = (if withTeensyduino then "teensyduino" else "arduino")
+             + stdenv.lib.optionalString (!withGui) "-core";
 in
 stdenv.mkDerivation rec {
   version = "1.8.12";
@@ -90,28 +91,23 @@ stdenv.mkDerivation rec {
   teensyduino_version = "151";
   teensyduino_src = fetchurl {
     url = "https://www.pjrc.com/teensy/td_${teensyduino_version}/TeensyduinoInstall.${teensy_architecture}";
-    sha256 =
-      lib.optionalString (teensy_architecture == "linux64")
-        "0q8mw9bm2vb5vwa98gwcs6ad164i98hc1qqh2qw029yhwm599pn0"
-      + lib.optionalString (teensy_architecture == "linux32")
-        "1rq6sx0048ab200jy0cz5vznwxi99avidngj42rjnh7kcfas5c4m"
-      + lib.optionalString (teensy_architecture == "linuxaarch64")
-        "09k78dycn1vcpcx37c1dak8bgjv8gs34l89n9r9s0c3rqmv3pg4x"
-      + lib.optionalString (teensy_architecture == "linuxarm")
-        "19j55bq36040rpdpfxcqimda76rkbx137q15bs8nvxj13wrbl4ip";
+    sha256 = {
+      linux64 = "0q8mw9bm2vb5vwa98gwcs6ad164i98hc1qqh2qw029yhwm599pn0";
+      linux32 = "1rq6sx0048ab200jy0cz5vznwxi99avidngj42rjnh7kcfas5c4m";
+      linuxarm = "19j55bq36040rpdpfxcqimda76rkbx137q15bs8nvxj13wrbl4ip";
+      linuxaarch64 = "09k78dycn1vcpcx37c1dak8bgjv8gs34l89n9r9s0c3rqmv3pg4x";
+    }.${teensy_architecture} or (throw "No arduino binaries for ${teensy_architecture}");
   };
   # Used because teensyduino requires jars be a specific size
   arduino_dist_src = fetchurl {
     url = "http://downloads.arduino.cc/arduino-${version}-${teensy_architecture}.tar.xz";
     sha256 =
-      lib.optionalString (teensy_architecture == "linux64")
-        "128f34kkxz7ab6ir5mqyr8d1mgxig8f9jygwxy44pdnq2rk6gmh9"
-      + lib.optionalString (teensy_architecture == "linux32")
-        "11n85lwsn1w4ysfacyw08v85s3f3zvl8j8ac7rld19yxgjslvisi"
-      + lib.optionalString (teensy_architecture == "linuxaarch64")
-        "04v2nhyjhahml6nmz23bfb63c0an4a7zxgcgxqqq442i8vd304wa"
-      + lib.optionalString (teensy_architecture == "linuxarm")
-        "1k8yjivaydm6y16mplrjyblgx7l0wjzm3mjxh5saxrjq7drswmxx";
+      {
+        linux64 = "128f34kkxz7ab6ir5mqyr8d1mgxig8f9jygwxy44pdnq2rk6gmh9";
+        linux32 = "11n85lwsn1w4ysfacyw08v85s3f3zvl8j8ac7rld19yxgjslvisi";
+        linuxarm = "1k8yjivaydm6y16mplrjyblgx7l0wjzm3mjxh5saxrjq7drswmxx";
+        linuxaarch64 = "04v2nhyjhahml6nmz23bfb63c0an4a7zxgcgxqqq442i8vd304wa";
+      }.${teensy_architecture} or (throw "No arduino binaries for ${teensy_architecture}");
   };
 
 
diff --git a/nixpkgs/pkgs/development/arduino/platformio/chrootenv.nix b/nixpkgs/pkgs/development/arduino/platformio/chrootenv.nix
index 01a2fb873aa2..91300bda8f1c 100644
--- a/nixpkgs/pkgs/development/arduino/platformio/chrootenv.nix
+++ b/nixpkgs/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 = "v5.0.1";
+    sha256 = "01xh61ldilg6fg95l1p870rld2xffhnl9f9ndvbi5jdn8q634pmw";
+  };
+
+
 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/nixpkgs/pkgs/development/arduino/platformio/core.nix b/nixpkgs/pkgs/development/arduino/platformio/core.nix
index 0d333a49d37a..835e0c692e4b 100644
--- a/nixpkgs/pkgs/development/arduino/platformio/core.nix
+++ b/nixpkgs/pkgs/development/arduino/platformio/core.nix
@@ -9,33 +9,57 @@
 let
   args = lib.concatStringsSep " " ((map (e: "--deselect tests/${e}") [
     "commands/test_ci.py::test_ci_boards"
-    "commands/test_ci.py::test_ci_project_conf"
-    "commands/test_ci.py::test_ci_lib_and_board"
     "commands/test_ci.py::test_ci_build_dir"
     "commands/test_ci.py::test_ci_keep_build_dir"
-    "commands/test_init.py::test_init_enable_auto_uploading"
+    "commands/test_ci.py::test_ci_lib_and_board"
+    "commands/test_ci.py::test_ci_project_conf"
     "commands/test_init.py::test_init_custom_framework"
-    "commands/test_init.py::test_init_incorrect_board"
+    "commands/test_init.py::test_init_duplicated_boards"
+    "commands/test_init.py::test_init_enable_auto_uploading"
     "commands/test_init.py::test_init_ide_atom"
     "commands/test_init.py::test_init_ide_eclipse"
-    "commands/test_init.py::test_init_duplicated_boards"
+    "commands/test_init.py::test_init_ide_vscode"
+    "commands/test_init.py::test_init_incorrect_board"
     "commands/test_init.py::test_init_special_board"
-    "commands/test_lib.py::test_search"
-    "commands/test_lib.py::test_install_duplicates"
-    "commands/test_lib.py::test_global_lib_update_check"
-    "commands/test_lib.py::test_global_lib_update"
-    "commands/test_lib.py::test_global_lib_uninstall"
-    "commands/test_lib.py::test_lib_show"
-    "commands/test_lib.py::test_lib_stats"
-    "commands/test_lib.py::test_global_install_registry"
     "commands/test_lib.py::test_global_install_archive"
+    "commands/test_lib.py::test_global_install_registry"
     "commands/test_lib.py::test_global_install_repository"
     "commands/test_lib.py::test_global_lib_list"
+    "commands/test_lib.py::test_global_lib_uninstall"
+    "commands/test_lib.py::test_global_lib_update"
+    "commands/test_lib.py::test_global_lib_update_check"
+    "commands/test_lib.py::test_install_duplicates"
+    "commands/test_lib.py::test_lib_show"
+    "commands/test_lib.py::test_lib_stats"
+    "commands/test_lib.py::test_saving_deps"
+    "commands/test_lib.py::test_search"
+    "commands/test_lib.py::test_update"
+    "commands/test_lib_complex.py::test_global_install_archive"
+    "commands/test_lib_complex.py::test_global_install_registry"
+    "commands/test_lib_complex.py::test_global_install_repository"
+    "commands/test_lib_complex.py::test_global_lib_list"
+    "commands/test_lib_complex.py::test_global_lib_uninstall"
+    "commands/test_lib_complex.py::test_global_lib_update"
+    "commands/test_lib_complex.py::test_global_lib_update_check"
+    "commands/test_lib_complex.py::test_install_duplicates"
+    "commands/test_lib_complex.py::test_lib_show"
+    "commands/test_lib_complex.py::test_lib_stats"
+    "commands/test_lib_complex.py::test_search"
     "commands/test_test.py::test_local_env"
+    "commands/test_test.py::test_multiple_env_build"
+    "commands/test_test.py::test_setup_teardown_are_compilable"
+    "package/test_manager.py::test_download"
+    "package/test_manager.py::test_install_force"
+    "package/test_manager.py::test_install_from_registry"
+    "package/test_manager.py::test_install_lib_depndencies"
+    "package/test_manager.py::test_registry"
+    "package/test_manager.py::test_uninstall"
+    "package/test_manager.py::test_update_with_metadata"
+    "package/test_manager.py::test_update_without_metadata"
     "test_builder.py::test_build_flags"
     "test_builder.py::test_build_unflags"
-    "test_builder.py::test_debug_default_build_flags"
     "test_builder.py::test_debug_custom_build_flags"
+    "test_builder.py::test_debug_default_build_flags"
     "test_misc.py::test_api_cache"
     "test_misc.py::test_ping_internet_ips"
     "test_misc.py::test_platformio_cli"
@@ -51,14 +75,14 @@ let
 
 in buildPythonApplication rec {
   pname = "platformio";
-  version = "4.3.1";
+  version = "5.0.1";
 
   # pypi tarballs don't contain tests - https://github.com/platformio/platformio-core/issues/1964
   src = fetchFromGitHub {
     owner = "platformio";
     repo = "platformio-core";
     rev = "v${version}";
-    sha256 = "1dxnjy60zpkgyrbvbf6b9qi6m37gm8gwjmxwfj30npr1y7rvxwrw";
+    sha256 = "01xh61ldilg6fg95l1p870rld2xffhnl9f9ndvbi5jdn8q634pmw";
   };
 
   propagatedBuildInputs =  [
@@ -82,6 +106,7 @@ in buildPythonApplication rec {
   patches = [
     ./fix-searchpath.patch
     ./use-local-spdx-license-list.patch
+    ./missing-udev-rules-nixos.patch
   ];
 
   postPatch = ''
diff --git a/nixpkgs/pkgs/development/arduino/platformio/missing-udev-rules-nixos.patch b/nixpkgs/pkgs/development/arduino/platformio/missing-udev-rules-nixos.patch
new file mode 100644
index 000000000000..36af82245c53
--- /dev/null
+++ b/nixpkgs/pkgs/development/arduino/platformio/missing-udev-rules-nixos.patch
@@ -0,0 +1,12 @@
+diff --git a/platformio/exception.py b/platformio/exception.py
+index ef1d3bab..445174fc 100644
+--- a/platformio/exception.py
++++ b/platformio/exception.py
+@@ -57,6 +57,7 @@ class MissedUdevRules(InvalidUdevRules):
+     MESSAGE = (
+         "Warning! Please install `99-platformio-udev.rules`. \nMore details: "
+         "https://docs.platformio.org/page/faq.html#platformio-udev-rules"
++        "On NixOS add the platformio package to services.udev.packages"
+     )
+ 
+ 
diff --git a/nixpkgs/pkgs/development/arduino/platformio/use-local-spdx-license-list.patch b/nixpkgs/pkgs/development/arduino/platformio/use-local-spdx-license-list.patch
index 16294a4d6cd6..511d81c3b012 100644
--- a/nixpkgs/pkgs/development/arduino/platformio/use-local-spdx-license-list.patch
+++ b/nixpkgs/pkgs/development/arduino/platformio/use-local-spdx-license-list.patch
@@ -1,16 +1,11 @@
 diff --git a/platformio/package/manifest/schema.py b/platformio/package/manifest/schema.py
-index be49b3ee..d1390a88 100644
+index f293ba5a..a818271f 100644
 --- a/platformio/package/manifest/schema.py
 +++ b/platformio/package/manifest/schema.py
-@@ -240,9 +240,5 @@ class ManifestSchema(BaseSchema):
+@@ -252,5 +252,4 @@ class ManifestSchema(BaseSchema):
      @staticmethod
      @memoized(expire="1h")
      def load_spdx_licenses():
--        r = requests.get(
--            "https://raw.githubusercontent.com/spdx/license-list-data"
--            "/v3.8/json/licenses.json"
--        )
--        r.raise_for_status()
--        return r.json()
-+        import json
+-        spdx_data_url = "https://dl.bintray.com/platformio/dl-misc/spdx-licenses-3.json"
+-        return json.loads(fetch_remote_content(spdx_data_url))
 +        return json.load(open("@SPDX_LICENSE_LIST_DATA@/json/licenses.json"))