about summary refs log tree commit diff stats
path: root/nix/overlays/bleve.nix
blob: 8e36679b259c43382a51a932672062c432b9e570 (plain)
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
, stdenv
, fetchFromGitHub
, installShellFiles
, buildGoModule
}:
let
  gomod = builtins.fromTOML (builtins.readFile ./../../gomod2nix.toml);
  version = gomod.mod."github.com/blevesearch/bleve/v2".version;
in
buildGoModule rec {
  pname = "bleve";
  inherit version;

  src = fetchFromGitHub {
    owner = "blevesearch";
    repo = "bleve";
    rev = version;
    hash = "sha256-E7ykT0t4QTn615WfTE9EygD+p5kQQ3Qm7zZ/Jqb8tK8=";
  };

  vendorHash = "sha256-gkajiRCY+tPifBz5PRelFCZCfaWN/pti+7amuRmQI6Q=";

  subPackages = [ "cmd/bleve" ];

  nativeBuildInputs = [ installShellFiles ];
  postInstall = lib.optionalString (stdenv.buildPlatform == stdenv.targetPlatform) ''
    installShellCompletion --cmd bleve \
      --bash <($out/bin/bleve completion bash) \
      --fish <($out/bin/bleve completion fish) \
      --zsh <($out/bin/bleve completion zsh)
  '';

  meta = {
    description = "Command-line tool to interact with bleve indexes";
    homepage = "http://blevesearch.com";
    licenses = lib.licenses.asl20;
  };
}