about summary refs log tree commit diff
path: root/pkgs/tools/text/fst/default.nix
blob: 1f1b2950e160dac39f7f583f7fd5b3e59b8b8997 (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
{ lib
, rustPlatform
, fetchCrate
, stdenv
, libiconv
}:

rustPlatform.buildRustPackage rec {
  pname = "fst";
  version = "0.4.3";

  src = fetchCrate {
    inherit version;
    crateName = "fst-bin";
    hash = "sha256-x2rvLMOhatMWU2u5GAdpYy2uuwZLi3apoE6aaTF+M1g=";
  };

  cargoHash = "sha256-yTbEaw+BbjVks3j7/b75kGoUjVftLaVYvYIdI/bbfdk=";

  buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];

  doInstallCheck = true;
  installCheckPhase = ''
    csv="$(mktemp)"
    fst="$(mktemp)"
    printf "abc,1\nabcd,1" > "$csv"
    $out/bin/fst map "$csv" "$fst" --force
    $out/bin/fst fuzzy "$fst" 'abc'
    $out/bin/fst --help > /dev/null
  '';

  meta = with lib; {
    description = "Represent large sets and maps compactly with finite state transducers";
    mainProgram = "fst";
    homepage = "https://github.com/BurntSushi/fst";
    license = with licenses; [ unlicense /* or */ mit ];
    maintainers = with maintainers; [ rmcgibbo ];
  };
}