about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/text/ov/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/text/ov/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/text/ov/default.nix71
1 files changed, 71 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/text/ov/default.nix b/nixpkgs/pkgs/tools/text/ov/default.nix
new file mode 100644
index 000000000000..20d7a40b7f58
--- /dev/null
+++ b/nixpkgs/pkgs/tools/text/ov/default.nix
@@ -0,0 +1,71 @@
+{ lib
+, buildGoModule
+, fetchFromGitHub
+, installShellFiles
+, pandoc
+, makeWrapper
+, testers
+, ov
+}:
+
+buildGoModule rec {
+  pname = "ov";
+  version = "0.30.0";
+
+  src = fetchFromGitHub {
+    owner = "noborus";
+    repo = "ov";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-xTnUTtMm986MnQEKgExWfABU8E8C+ZiRZvOpg3FY5cY=";
+  };
+
+  vendorHash = "sha256-bQREazHu0SQrMKyNPtUvzeKR/zb0FJOLpHBwHml43Hs=";
+
+  ldflags = [
+    "-s"
+    "-w"
+    "-X=main.Version=v${version}"
+    "-X=main.Revision=${src.rev}"
+  ];
+
+  subPackages = [ "." ];
+
+  nativeBuildInputs = [
+    installShellFiles
+    pandoc
+    makeWrapper
+  ];
+
+  outputs = [ "out" "doc" ];
+
+  postInstall = ''
+    installShellCompletion --cmd ov \
+      --bash <($out/bin/ov completion bash) \
+      --fish <($out/bin/ov completion fish) \
+      --zsh <($out/bin/ov completion zsh)
+
+    mkdir -p $out/share/$name
+    cp $src/ov-less.yaml $out/share/$name/less-config.yaml
+    makeWrapper $out/bin/ov $out/bin/ov-less --add-flags "--config $out/share/$name/less-config.yaml"
+
+    mkdir -p $doc/share/doc/$name
+    pandoc -s < $src/README.md > $doc/share/doc/$name/README.html
+    mkdir -p $doc/share/$name
+    cp $src/ov.yaml $doc/share/$name/sample-config.yaml
+  '';
+
+  passthru.tests = {
+    version = testers.testVersion {
+      package = ov;
+      version = "v${version}";
+    };
+  };
+
+  meta = with lib; {
+    description = "Feature-rich terminal-based text viewer";
+    homepage = "https://noborus.github.io/ov";
+    changelog = "https://github.com/noborus/ov/releases/tag/v${version}";
+    license = licenses.mit;
+    maintainers = with maintainers; [ farcaller figsoda ];
+  };
+}