about summary refs log tree commit diff
path: root/pkgs/development/libraries/rure/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/rure/default.nix')
-rw-r--r--pkgs/development/libraries/rure/default.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/pkgs/development/libraries/rure/default.nix b/pkgs/development/libraries/rure/default.nix
new file mode 100644
index 0000000000000..aef8b9c8f3e2f
--- /dev/null
+++ b/pkgs/development/libraries/rure/default.nix
@@ -0,0 +1,41 @@
+{ lib
+, stdenv
+, rustPlatform
+, fetchCrate
+}:
+
+let
+  pin = lib.importJSON ./pin.json;
+in
+
+rustPlatform.buildRustPackage {
+  inherit (pin) pname version;
+
+  src = fetchCrate pin;
+
+  # upstream doesn't ship a Cargo.lock, is generated by the update script
+  postPatch = ''
+    cp ${./Cargo.lock} Cargo.lock
+  '';
+
+  cargoLock.lockFile = ./Cargo.lock;
+
+  outputs = [ "out" "dev" ];
+
+  # Headers are not handled by cargo nor buildRustPackage
+  postInstall = ''
+    install -Dm644 include/rure.h -t "$dev/include"
+  '';
+
+  passthru.updateScript = ./update.sh;
+
+  meta = {
+    description = "A C API for Rust's regular expression library";
+    homepage = "https://crates.io/crates/rure";
+    license = [
+      lib.licenses.mit
+      lib.licenses.asl20
+    ];
+    maintainers = [ lib.maintainers.sternenseemann ];
+  };
+}