2022-09-04 01:23:15 +02:00
|
|
|
{ lib
|
2023-10-22 17:58:27 +02:00
|
|
|
, stdenv
|
2022-09-04 01:23:15 +02:00
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
2023-10-22 17:58:27 +02:00
|
|
|
, installShellFiles
|
2022-09-04 01:23:15 +02:00
|
|
|
, testers
|
|
|
|
, tbls
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "tbls";
|
2024-01-29 18:54:34 +01:00
|
|
|
version = "1.73.2";
|
2022-09-04 01:23:15 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "k1LoW";
|
|
|
|
repo = "tbls";
|
|
|
|
rev = "v${version}";
|
2024-01-29 18:54:34 +01:00
|
|
|
hash = "sha256-UXvUewArdClOolWFgN4Ta11vzq9C9zBjEzVGTtWSjiA=";
|
2022-09-04 01:23:15 +02:00
|
|
|
};
|
|
|
|
|
2024-01-29 18:54:34 +01:00
|
|
|
vendorHash = "sha256-zNQADZkAaohTZReD8qTnNJsfy58NXdQjUdd5j8KcOyY=";
|
2022-09-04 01:23:15 +02:00
|
|
|
|
2023-10-22 17:58:27 +02:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
ldflags = [ "-s" "-w" ];
|
2022-09-04 01:23:15 +02:00
|
|
|
|
2023-10-22 17:58:27 +02:00
|
|
|
CGO_CFLAGS = [ "-Wno-format-security" ];
|
2022-09-04 01:23:15 +02:00
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
# Remove tests that require additional services.
|
|
|
|
rm -f \
|
2023-10-22 17:58:27 +02:00
|
|
|
datasource/*_test.go \
|
2022-09-04 01:23:15 +02:00
|
|
|
drivers/*/*_test.go
|
|
|
|
'';
|
|
|
|
|
2023-10-22 17:58:27 +02: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-04 01:23:15 +02:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = tbls;
|
|
|
|
command = "tbls version";
|
2023-10-22 17:58:27 +02:00
|
|
|
inherit version;
|
2022-09-04 01:23:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
2023-10-22 17:58:27 +02:00
|
|
|
description = "A tool to generate documentation based on a database structure";
|
2022-09-04 01:23:15 +02: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 02:17:53 +01:00
|
|
|
mainProgram = "tbls";
|
2022-09-04 01:23:15 +02:00
|
|
|
};
|
|
|
|
}
|