tbls: minor fixes

This commit is contained in:
Azat Bahawi
2023-10-22 18:58:27 +03:00
parent 187c660416
commit b1b7cbb380

View File

@@ -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;