depot/third_party/nixpkgs/pkgs/development/interpreters/micropython/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

63 lines
1.4 KiB
Nix

{ stdenv
, lib
, fetchFromGitHub
, pkg-config
, python3
, libffi
, readline
}:
stdenv.mkDerivation rec {
pname = "micropython";
version = "1.23.0";
src = fetchFromGitHub {
owner = "micropython";
repo = "micropython";
rev = "v${version}";
sha256 = "sha256-sfJohmsqq5FumUoVE8x3yWv12DiCJJXae62br0j+190=";
fetchSubmodules = true;
};
nativeBuildInputs = [ pkg-config python3 ];
buildInputs = [ libffi readline ];
buildPhase = ''
runHook preBuild
make -C mpy-cross
make -C ports/unix
runHook postBuild
'';
doCheck = true;
skippedTests = " -e select_poll_fd"
+ lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) " -e ffi_callback"
+ lib.optionalString (stdenv.isLinux && stdenv.isAarch64) " -e float_parse"
;
checkPhase = ''
runHook preCheck
pushd tests
${python3.interpreter} ./run-tests.py ${skippedTests}
popd
runHook postCheck
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install -Dm755 ports/unix/build-standard/micropython -t $out/bin
install -Dm755 mpy-cross/build/mpy-cross -t $out/bin
runHook postInstall
'';
meta = with lib; {
description = "Lean and efficient Python implementation for microcontrollers and constrained systems";
homepage = "https://micropython.org";
platforms = platforms.unix;
license = licenses.mit;
maintainers = with maintainers; [ prusnak sgo ];
};
}