2022-09-03 23:23:15 +00:00
|
|
|
{ lib
|
2023-10-22 15:58:27 +00:00
|
|
|
, stdenv
|
2022-09-03 23:23:15 +00:00
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
2023-10-22 15:58:27 +00:00
|
|
|
, installShellFiles
|
2022-09-03 23:23:15 +00:00
|
|
|
, testers
|
|
|
|
, tbls
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "tbls";
|
2023-11-26 11:53:01 +00:00
|
|
|
version = "1.72.0";
|
2022-09-03 23:23:15 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "k1LoW";
|
|
|
|
repo = "tbls";
|
|
|
|
rev = "v${version}";
|
2023-11-26 11:53:01 +00:00
|
|
|
hash = "sha256-FxG8vTbBMgFa+z1/8+ci7UxOfU88JynenZfVBh+0UPM=";
|
2022-09-03 23:23:15 +00:00
|
|
|
};
|
|
|
|
|
2023-11-14 12:42:46 +00:00
|
|
|
vendorHash = "sha256-1w1pQyHTuEJ1w01lJIZhXuEArFigjoFKGvi0cpFd8m0=";
|
2022-09-03 23:23:15 +00:00
|
|
|
|
2023-10-22 15:58:27 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
ldflags = [ "-s" "-w" ];
|
2022-09-03 23:23:15 +00:00
|
|
|
|
2023-10-22 15:58:27 +00:00
|
|
|
CGO_CFLAGS = [ "-Wno-format-security" ];
|
2022-09-03 23:23:15 +00:00
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
# Remove tests that require additional services.
|
|
|
|
rm -f \
|
2023-10-22 15:58:27 +00:00
|
|
|
datasource/*_test.go \
|
2022-09-03 23:23:15 +00:00
|
|
|
drivers/*/*_test.go
|
|
|
|
'';
|
|
|
|
|
2023-10-22 15:58:27 +00:00
|
|
|
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)
|
|
|
|
'';
|
|
|
|
|
2022-09-03 23:23:15 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = tbls;
|
|
|
|
command = "tbls version";
|
2023-10-22 15:58:27 +00:00
|
|
|
inherit version;
|
2022-09-03 23:23:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
2023-10-22 15:58:27 +00:00
|
|
|
description = "A tool to generate documentation based on a database structure";
|
2022-09-03 23:23:15 +00:00
|
|
|
homepage = "https://github.com/k1LoW/tbls";
|
|
|
|
changelog = "https://github.com/k1LoW/tbls/blob/${src.rev}/CHANGELOG.md";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ azahi ];
|
2023-11-27 01:17:53 +00:00
|
|
|
mainProgram = "tbls";
|
2022-09-03 23:23:15 +00:00
|
|
|
};
|
|
|
|
}
|