nixpkgs/pkgs/development/interpreters/micropython/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

63 lines
1.3 KiB
Nix
Raw Normal View History

{ stdenv
, lib
, fetchFromGitHub
, pkg-config
, python3
2021-09-10 13:33:43 +02:00
, libffi
, readline
}:
2019-12-04 03:52:10 +01:00
stdenv.mkDerivation rec {
pname = "micropython";
2023-10-11 07:10:32 +02:00
version = "1.21.0";
2019-12-04 03:52:10 +01:00
src = fetchFromGitHub {
2022-07-25 18:27:25 +02:00
owner = "micropython";
repo = "micropython";
rev = "v${version}";
2023-10-11 07:10:32 +02:00
sha256 = "sha256-nUQSj2grq4fNyqOZyYZfYvLwoEXI4PZCYdVXvxLGmPk=";
2019-12-04 03:52:10 +01:00
fetchSubmodules = true;
};
nativeBuildInputs = [ pkg-config python3 ];
2019-12-04 03:52:10 +01:00
buildInputs = [ libffi readline ];
buildPhase = ''
runHook preBuild
2019-12-04 03:52:10 +01:00
make -C mpy-cross
make -C ports/unix
runHook postBuild
2019-12-04 03:52:10 +01:00
'';
doCheck = true;
skippedTests = ""
+ lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) " -e ffi_callback"
+ lib.optionalString (stdenv.isLinux && stdenv.isAarch64) " -e float_parse"
;
2019-12-04 03:52:10 +01:00
checkPhase = ''
runHook preCheck
2019-12-04 03:52:10 +01:00
pushd tests
${python3.interpreter} ./run-tests.py ${skippedTests}
2019-12-04 03:52:10 +01:00
popd
runHook postCheck
2019-12-04 03:52:10 +01:00
'';
installPhase = ''
2021-06-06 16:12:00 +02:00
runHook preInstall
2019-12-04 03:52:10 +01:00
mkdir -p $out/bin
2023-09-25 16:25:49 +02:00
install -Dm755 ports/unix/build-standard/micropython -t $out/bin
2021-06-06 16:12:00 +02:00
runHook postInstall
2019-12-04 03:52:10 +01:00
'';
meta = with lib; {
description = "A lean and efficient Python implementation for microcontrollers and constrained systems";
homepage = "https://micropython.org";
platforms = platforms.unix;
2019-12-04 03:52:10 +01:00
license = licenses.mit;
2021-09-10 13:33:43 +02:00
maintainers = with maintainers; [ prusnak sgo ];
2019-12-04 03:52:10 +01:00
};
}