about summary refs log tree commit diff
path: root/pkgs/by-name/ma/maturin/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/ma/maturin/package.nix')
-rw-r--r--pkgs/by-name/ma/maturin/package.nix72
1 files changed, 72 insertions, 0 deletions
diff --git a/pkgs/by-name/ma/maturin/package.nix b/pkgs/by-name/ma/maturin/package.nix
new file mode 100644
index 0000000000000..d075c1882bb91
--- /dev/null
+++ b/pkgs/by-name/ma/maturin/package.nix
@@ -0,0 +1,72 @@
+{
+  lib,
+  stdenv,
+  fetchFromGitHub,
+  rustPlatform,
+  darwin,
+  libiconv,
+  testers,
+  nix-update-script,
+  maturin,
+  python3,
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "maturin";
+  version = "1.7.0";
+
+  src = fetchFromGitHub {
+    owner = "PyO3";
+    repo = "maturin";
+    rev = "v${version}";
+    hash = "sha256-SjINeNtCbyMp3U+Op7ey+8lV7FYxLVpmO5g1a01ouBs=";
+  };
+
+  cargoHash = "sha256-xJafCgpCeihyORj3gIVUus74vu9h3N1xuyKvkxSqYK4=";
+
+  buildInputs = lib.optionals stdenv.isDarwin [
+    darwin.apple_sdk.frameworks.Security
+    libiconv
+  ];
+
+  # Requires network access, fails in sandbox.
+  doCheck = false;
+
+  passthru = {
+    tests = {
+      version = testers.testVersion { package = maturin; };
+      pyo3 = python3.pkgs.callPackage ./pyo3-test {
+        format = "pyproject";
+        buildAndTestSubdir = "examples/word-count";
+        preConfigure = "";
+
+        nativeBuildInputs = with rustPlatform; [
+          cargoSetupHook
+          maturinBuildHook
+        ];
+      };
+    };
+
+    updateScript = nix-update-script { };
+  };
+
+  meta = {
+    description = "Build and publish Rust crates Python packages";
+    longDescription = ''
+      Build and publish Rust crates with PyO3, rust-cpython, and
+      cffi bindings as well as Rust binaries as Python packages.
+
+      This project is meant as a zero-configuration replacement for
+      setuptools-rust and Milksnake. It supports building wheels for
+      Python and can upload them to PyPI.
+    '';
+    homepage = "https://github.com/PyO3/maturin";
+    changelog = "https://github.com/PyO3/maturin/blob/v${version}/Changelog.md";
+    license = with lib.licenses; [
+      asl20 # or
+      mit
+    ];
+    maintainers = with lib.maintainers; [ getchoo ];
+    mainProgram = "maturin";
+  };
+}