about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/tbls/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/misc/tbls/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/misc/tbls/default.nix28
1 files changed, 16 insertions, 12 deletions
diff --git a/nixpkgs/pkgs/tools/misc/tbls/default.nix b/nixpkgs/pkgs/tools/misc/tbls/default.nix
index de880c201446..8c3f840a6e22 100644
--- a/nixpkgs/pkgs/tools/misc/tbls/default.nix
+++ b/nixpkgs/pkgs/tools/misc/tbls/default.nix
@@ -1,6 +1,8 @@
 { lib
+, stdenv
 , buildGoModule
 , fetchFromGitHub
+, installShellFiles
 , testers
 , tbls
 }:
@@ -18,32 +20,34 @@ buildGoModule rec {
 
   vendorHash = "sha256-84h+LQzk/xy/Gapy7IxB8IPvsVGRsJP7udd9HhLskew=";
 
-  CGO_CFLAGS = [ "-Wno-format-security" ];
+  nativeBuildInputs = [ installShellFiles ];
+
+  ldflags = [ "-s" "-w" ];
 
-  ldflags = [
-    "-s"
-    "-w"
-    "-X github.com/k1LoW/tbls.commit=unspecified"
-    "-X github.com/k1LoW/tbls.date=unspecified"
-    "-X github.com/k1LoW/tbls.version=${src.rev}"
-    "-X github.com/k1LoW/tbls/version.Version=${src.rev}"
-  ];
+  CGO_CFLAGS = [ "-Wno-format-security" ];
 
   preCheck = ''
     # Remove tests that require additional services.
     rm -f \
-       datasource/datasource_test.go \
+       datasource/*_test.go \
        drivers/*/*_test.go
   '';
 
+  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
+    installShellCompletion --cmd tbls \
+      --bash <($out/bin/tbls completion bash) \
+      --fish <($out/bin/tbls completion fish) \
+      --zsh <($out/bin/tbls completion zsh)
+  '';
+
   passthru.tests.version = testers.testVersion {
     package = tbls;
     command = "tbls version";
-    version = src.rev;
+    inherit version;
   };
 
   meta = with lib; {
-    description = "A tool to generate documentation based on a database";
+    description = "A tool to generate documentation based on a database structure";
     homepage = "https://github.com/k1LoW/tbls";
     changelog = "https://github.com/k1LoW/tbls/blob/${src.rev}/CHANGELOG.md";
     license = licenses.mit;