From b1b7cbb380c5f81a2e0c80e6bbef6dffe72f15a8 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 22 Oct 2023 18:58:27 +0300 Subject: [PATCH] tbls: minor fixes --- pkgs/tools/misc/tbls/default.nix | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/pkgs/tools/misc/tbls/default.nix b/pkgs/tools/misc/tbls/default.nix index de880c201446..8c3f840a6e22 100644 --- a/pkgs/tools/misc/tbls/default.nix +++ b/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" - "-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}" - ]; + ldflags = [ "-s" "-w" ]; + + 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;