1{ lib
2, stdenv
3, rustPlatform
4, fetchFromGitHub
5, SystemConfiguration
6, python3
7, fetchpatch
8}:
9
10rustPlatform.buildRustPackage rec {
11 pname = "rustpython";
12 version = "0.2.0";
13
14 src = fetchFromGitHub {
15 owner = "RustPython";
16 repo = "RustPython";
17 rev = "v${version}";
18 hash = "sha256-RNUOBBbq4ca9yEKNj5TZTOQW0hruWOIm/G+YCHoJ19U=";
19 };
20
21 cargoLock = {
22 lockFile = ./Cargo.lock;
23 outputHashes = {
24 "rustpython-doc-0.1.0" = "sha256-4xBiV1FcYA05cWs9fQV+OklZEU1VZunhCo9deOSWPe8=";
25 };
26 };
27
28 patches = [
29 # Fix aarch64 compatibility for sqlite. Remove with the next release. https://github.com/RustPython/RustPython/pull/4499
30 (fetchpatch {
31 url = "https://github.com/RustPython/RustPython/commit/9cac89347e2276fcb309f108561e99f4be5baff2.patch";
32 hash = "sha256-vUPQI/5ec6/36Vdtt7/B2unPDsVrGh5iEiSMBRatxWU=";
33 })
34 ];
35
36 # freeze the stdlib into the rustpython binary
37 cargoBuildFlags = [ "--features=freeze-stdlib" ];
38
39 buildInputs = lib.optionals stdenv.isDarwin [ SystemConfiguration ];
40
41 nativeCheckInputs = [ python3 ];
42
43 meta = with lib; {
44 description = "Python 3 interpreter in written Rust";
45 homepage = "https://rustpython.github.io";
46 license = licenses.mit;
47 maintainers = with maintainers; [ prusnak ];
48 };
49}