nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, lib, fetchFromGitHub, pkg-config, libffi, python3, readline }:
2
3stdenv.mkDerivation rec {
4 pname = "micropython";
5 version = "1.13";
6
7 src = fetchFromGitHub {
8 owner = "micropython";
9 repo = "micropython";
10 rev = "v${version}";
11 sha256 = "0m9g6isys4pnlnkdmrw7lxaxdrjn02j481wz5x5cdrmrbi4zi17z";
12 fetchSubmodules = true;
13 };
14
15 nativeBuildInputs = [ pkg-config python3 ];
16
17 buildInputs = [ libffi readline ];
18
19 doCheck = true;
20
21 buildPhase = ''
22 make -C mpy-cross
23 make -C ports/unix
24 '';
25
26 checkPhase = ''
27 pushd tests
28 MICROPY_MICROPYTHON=../ports/unix/micropython ${python3.interpreter} ./run-tests
29 popd
30 '';
31
32 installPhase = ''
33 mkdir -p $out/bin
34 install -Dm755 ports/unix/micropython $out/bin/micropython
35 '';
36
37 meta = with lib; {
38 description = "A lean and efficient Python implementation for microcontrollers and constrained systems";
39 homepage = "https://micropython.org";
40 platforms = [ "x86_64-linux" ];
41 license = licenses.mit;
42 maintainers = with maintainers; [ sgo ];
43 };
44}