Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 24.05-beta 63 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.22.2"; 13 14 src = fetchFromGitHub { 15 owner = "micropython"; 16 repo = "micropython"; 17 rev = "v${version}"; 18 sha256 = "sha256-sdok17HvKub/sI+8cAIIDaLD/3mu8yXXqrTOej8/UfU="; 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 = " -e select_poll_fd" 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 install -Dm755 mpy-cross/build/mpy-cross -t $out/bin 53 runHook postInstall 54 ''; 55 56 meta = with lib; { 57 description = "A lean and efficient Python implementation for microcontrollers and constrained systems"; 58 homepage = "https://micropython.org"; 59 platforms = platforms.unix; 60 license = licenses.mit; 61 maintainers = with maintainers; [ prusnak sgo ]; 62 }; 63}