From d3b08d1bd0c0b3fd81e847f64458b55810a6ed01 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Mon, 19 Aug 2024 14:46:03 -0500 Subject: [PATCH 1/3] micropython: use Nix make infra and build in parallel --- pkgs/development/interpreters/micropython/default.nix | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkgs/development/interpreters/micropython/default.nix b/pkgs/development/interpreters/micropython/default.nix index 6437e942ae344..b80038ff28f8f 100644 --- a/pkgs/development/interpreters/micropython/default.nix +++ b/pkgs/development/interpreters/micropython/default.nix @@ -23,12 +23,9 @@ stdenv.mkDerivation rec { buildInputs = [ libffi readline ]; - buildPhase = '' - runHook preBuild - make -C mpy-cross - make -C ports/unix - runHook postBuild - ''; + makeFlags = [ "-C" "ports/unix" ]; # also builds mpy-cross + + enableParallelBuilding = true; doCheck = true; From 2e0d57b792dcebb7c2170835ccde811cb8123a52 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Mon, 19 Aug 2024 14:54:35 -0500 Subject: [PATCH 2/3] micropython: reduce source size to within Hydra limit Uncompressed NAR goes from ~3.3G to ~970M. --- .../interpreters/micropython/default.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/micropython/default.nix b/pkgs/development/interpreters/micropython/default.nix index b80038ff28f8f..46a599987c820 100644 --- a/pkgs/development/interpreters/micropython/default.nix +++ b/pkgs/development/interpreters/micropython/default.nix @@ -15,10 +15,21 @@ stdenv.mkDerivation rec { owner = "micropython"; repo = "micropython"; rev = "v${version}"; - sha256 = "sha256-sdok17HvKub/sI+8cAIIDaLD/3mu8yXXqrTOej8/UfU="; + sha256 = "sha256-7AA9n6UQchY6POkOp1VWAOAo87uRJSeCBhgvVXLoE04="; fetchSubmodules = true; + + # remove unused libaries from rp2 port's SDK. we leave this and the other + # ports around for users who want to override makeFlags flags to build them. + # https://github.com/micropython/micropython/blob/a61c446c0b34e82aeb54b9770250d267656f2b7f/ports/rp2/CMakeLists.txt#L17-L22 + # + # shrinks uncompressed NAR by ~2.4G (though it is still large). there + # doesn't seem to be a way to avoid fetching them in the first place. + postFetch = '' + rm -rf $out/lib/pico-sdk/lib/{tinyusb,lwip,btstack} + ''; }; + nativeBuildInputs = [ pkg-config python3 ]; buildInputs = [ libffi readline ]; From 8234ac117922220f8ed0b9f537434c2e568b6593 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Mon, 19 Aug 2024 14:56:16 -0500 Subject: [PATCH 3/3] micropython: fix tests on darwin --- pkgs/development/interpreters/micropython/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/micropython/default.nix b/pkgs/development/interpreters/micropython/default.nix index 46a599987c820..eb6e43032bb41 100644 --- a/pkgs/development/interpreters/micropython/default.nix +++ b/pkgs/development/interpreters/micropython/default.nix @@ -40,8 +40,10 @@ stdenv.mkDerivation rec { doCheck = true; + __darwinAllowLocalNetworking = true; # needed for select_poll_eintr test + skippedTests = " -e select_poll_fd" - + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) " -e ffi_callback" + + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) " -e ffi_callback -e float_parse -e float_parse_doubleproc" + lib.optionalString (stdenv.isLinux && stdenv.isAarch64) " -e float_parse" ;