at 24.05-pre 62 lines 1.4 kB view raw
1{ stdenv 2, lib 3, fetchFromGitHub 4, pkg-config 5, python3 6, libffi 7, readline 8}: 9 10stdenv.mkDerivation rec { 11 pname = "micropython"; 12 version = "1.21.0"; 13 14 src = fetchFromGitHub { 15 owner = "micropython"; 16 repo = "micropython"; 17 rev = "v${version}"; 18 sha256 = "sha256-nUQSj2grq4fNyqOZyYZfYvLwoEXI4PZCYdVXvxLGmPk="; 19 fetchSubmodules = true; 20 }; 21 22 nativeBuildInputs = [ pkg-config python3 ]; 23 24 buildInputs = [ libffi readline ]; 25 26 buildPhase = '' 27 runHook preBuild 28 make -C mpy-cross 29 make -C ports/unix 30 runHook postBuild 31 ''; 32 33 doCheck = true; 34 35 skippedTests = "" 36 + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) " -e ffi_callback" 37 + lib.optionalString (stdenv.isLinux && stdenv.isAarch64) " -e float_parse" 38 ; 39 40 checkPhase = '' 41 runHook preCheck 42 pushd tests 43 ${python3.interpreter} ./run-tests.py ${skippedTests} 44 popd 45 runHook postCheck 46 ''; 47 48 installPhase = '' 49 runHook preInstall 50 mkdir -p $out/bin 51 install -Dm755 ports/unix/build-standard/micropython -t $out/bin 52 runHook postInstall 53 ''; 54 55 meta = with lib; { 56 description = "A lean and efficient Python implementation for microcontrollers and constrained systems"; 57 homepage = "https://micropython.org"; 58 platforms = platforms.unix; 59 license = licenses.mit; 60 maintainers = with maintainers; [ prusnak sgo ]; 61 }; 62}