about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/rure/default.nix
blob: 1771abd3367afefdc75b47fdba60406347c08c2d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ lib
, stdenv
, rustPlatform
, fetchCrate
, fixDarwinDylibNames
}:

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"
  '';

  nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
    fixDarwinDylibNames
  ];

  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 ];
  };
}