about summary refs log tree commit diff stats
path: root/nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix')
-rw-r--r--nix/overlays/bleve.nix39
-rw-r--r--nix/overlays/default.nix1
2 files changed, 40 insertions, 0 deletions
diff --git a/nix/overlays/bleve.nix b/nix/overlays/bleve.nix
new file mode 100644
index 0000000..8e36679
--- /dev/null
+++ b/nix/overlays/bleve.nix
@@ -0,0 +1,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;
+  };
+}
diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix
index 3e5c925..db27c7e 100644
--- a/nix/overlays/default.nix
+++ b/nix/overlays/default.nix
@@ -3,4 +3,5 @@ self: super: {
     (final: prev:
       super.callPackage ./prettier-plugin-go-template { }
     );
+  bleve = super.callPackage ./bleve.nix { };
 }