summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Childs <lorne@cons.org.nz>2022-03-30 00:29:08 +0900
committerAndrew Childs <lorne@cons.org.nz>2023-04-01 13:13:15 +0900
commit119a521977c3b5e676af34ced6b8a3d1c9974bee (patch)
treecc7427f9224f5a9fdc04fdfbdb264ae4ab3171a5
parentdd3dfc468f34bba5df3232e2ef081e4c4ac15461 (diff)
downloadnixpkgs-119a521977c3b5e676af34ced6b8a3d1c9974bee.tar
nixpkgs-119a521977c3b5e676af34ced6b8a3d1c9974bee.tar.gz
nixpkgs-119a521977c3b5e676af34ced6b8a3d1c9974bee.tar.bz2
nixpkgs-119a521977c3b5e676af34ced6b8a3d1c9974bee.tar.lz
nixpkgs-119a521977c3b5e676af34ced6b8a3d1c9974bee.tar.xz
nixpkgs-119a521977c3b5e676af34ced6b8a3d1c9974bee.tar.zst
nixpkgs-119a521977c3b5e676af34ced6b8a3d1c9974bee.zip
platformio-core: expose unwrapped platformio as platformio-core
PlatformIO is a pure python package that is in turn a package
manager. In a pure NixOS environment, this means that any downloaded
binary packages will not run. To make PlatformIO usable, there's a
chrootenv wrapper. However, in a mixed environment like other linux or
darwin, the pure python version will work, and in the case of darwin
only the pure version will work, since the chrootenv wrapper is not
supported.

To handle the above use cases we have:

 * platformio -- unwrapped on darwin, wrapped on linux. Should always
                 provide a functional platformio.

 * platformio-core -- always unwrapped (like "bintools-unwrapped") for
                      when the wrapper is explicitly not required. For
                      example, on other linux where the chrootenv is
                      not supported.
-rw-r--r--pkgs/development/embedded/platformio/chrootenv.nix3
-rw-r--r--pkgs/development/embedded/platformio/default.nix4
-rw-r--r--pkgs/top-level/all-packages.nix3
3 files changed, 6 insertions, 4 deletions
diff --git a/pkgs/development/embedded/platformio/chrootenv.nix b/pkgs/development/embedded/platformio/chrootenv.nix
index 40aa4233741..9e84a8d6ba4 100644
--- a/pkgs/development/embedded/platformio/chrootenv.nix
+++ b/pkgs/development/embedded/platformio/chrootenv.nix
@@ -4,9 +4,9 @@ let
   pio-pkgs = pkgs:
     let
       python = pkgs.python3;
-      platformio = python.pkgs.callPackage ./core.nix { inherit version src; };
     in
     (with pkgs; [
+      platformio-core
       zlib
       git
       xdg-user-dirs
@@ -15,7 +15,6 @@ let
       setuptools
       pip
       bottle
-      platformio
     ]);
 
 in
diff --git a/pkgs/development/embedded/platformio/default.nix b/pkgs/development/embedded/platformio/default.nix
index 6fd8592a12c..fbcce7eae60 100644
--- a/pkgs/development/embedded/platformio/default.nix
+++ b/pkgs/development/embedded/platformio/default.nix
@@ -1,4 +1,4 @@
-{ newScope, fetchFromGitHub }:
+{ newScope, fetchFromGitHub, python3Packages }:
 
 let
   callPackage = newScope self;
@@ -14,6 +14,8 @@ let
   };
 
   self = {
+    platformio-core = python3Packages.callPackage ./core.nix { inherit version src; };
+
     platformio-chrootenv = callPackage ./chrootenv.nix { inherit version src; };
   };
 
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index fca8efb5b8f..8239fa321e8 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -11105,7 +11105,8 @@ with pkgs;
   };
 
   platformioPackages = dontRecurseIntoAttrs (callPackage ../development/embedded/platformio { });
-  platformio = platformioPackages.platformio-chrootenv;
+  platformio = if stdenv.isLinux then platformioPackages.platformio-chrootenv else platformioPackages.platformio-core;
+  platformio-core = platformioPackages.platformio-core;
 
   platinum-searcher = callPackage ../tools/text/platinum-searcher { };