Unverified Commit c448dceb authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #261124 from azahi/tbls-1701

tbls: minor fixes
parents 0453fee8 b1b7cbb3
Loading
Loading
Loading
Loading
+16 −12
Original line number Diff line number Diff line
{ 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;