10 stdenv.mkDerivation rec {
11 pname = "micropython";
14 src = fetchFromGitHub {
15 owner = "micropython";
18 hash = "sha256-cFoUa4ZpPy1MldlTeY9ISXi9ilulmhmaH5mapUDBzE8=";
19 fetchSubmodules = true;
21 # remove unused libraries from rp2 port's SDK. we leave this and the other
22 # ports around for users who want to override makeFlags flags to build them.
23 # https://github.com/micropython/micropython/blob/a61c446c0b34e82aeb54b9770250d267656f2b7f/ports/rp2/CMakeLists.txt#L17-L22
25 # shrinks uncompressed NAR by ~2.4G (though it is still large). there
26 # doesn't seem to be a way to avoid fetching them in the first place.
28 rm -rf $out/lib/pico-sdk/lib/{tinyusb,lwip,btstack}
33 nativeBuildInputs = [ pkg-config python3 ];
35 buildInputs = [ libffi readline ];
37 makeFlags = [ "-C" "ports/unix" ]; # also builds mpy-cross
39 enableParallelBuilding = true;
43 __darwinAllowLocalNetworking = true; # needed for select_poll_eintr test
45 skippedTests = " -e select_poll_fd"
46 + lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) " -e ffi_callback -e float_parse -e float_parse_doubleproc"
47 + lib.optionalString (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) " -e float_parse"
53 ${python3.interpreter} ./run-tests.py ${skippedTests}
61 install -Dm755 ports/unix/build-standard/micropython -t $out/bin
62 install -Dm755 mpy-cross/build/mpy-cross -t $out/bin
67 description = "Lean and efficient Python implementation for microcontrollers and constrained systems";
68 homepage = "https://micropython.org";
69 platforms = platforms.unix;
70 license = licenses.mit;
71 maintainers = with maintainers; [ prusnak sgo ];