@@ -0,0 +1,44 @@
1+{ lib
2+, stdenv
3+, rustPlatform
4+, fetchFromGitHub
5+, SystemConfiguration
6+, python3
7+}:
8+
9+rustPlatform.buildRustPackage rec {
10+ pname = "rustpython";
11+ version = "unstable-2021-12-09";
12+
13+ src = fetchFromGitHub {
14+ owner = "RustPython";
15+ repo = "RustPython";
16+ rev = "db3b3127df34ff5dd569301aa36ed71ae5624e4e";
17+ sha256 = "sha256-YwGfXs3A5L/18mHnnWubPU3Y8EI9uU3keJ2HJnnTwv0=";
18+ };
19+
20+ cargoHash = "sha256-T85kiPG80oZ4mwpb8Ag40wDHKx2Aens+gM7NGXan5lM=";
21+
22+ # freeze the stdlib into the rustpython binary
23+ cargoBuildFlags = "--features=freeze-stdlib";
24+
25+ buildInputs = lib.optionals stdenv.isDarwin [ SystemConfiguration ];
26+
27+ checkInputs = [ python3 ];
28+
29+ meta = with lib; {
30+ description = "Python 3 interpreter in written Rust";
31+ homepage = "https://rustpython.github.io";
32+ license = licenses.mit;
33+ maintainers = with maintainers; [ prusnak ];
34+
35+ # TODO: Remove once nixpkgs uses newer SDKs that supports '*at' functions.
36+ # Probably macOS SDK 10.13 or later. Check the current version in
37+ # .../os-specific/darwin/apple-sdk/default.nix
38+ #
39+ # From the build logs:
40+ #
41+ # > Undefined symbols for architecture x86_64: "_utimensat"
42+ broken = stdenv.isDarwin && stdenv.isx86_64;
43+ };
44+}