nixpkgs/pkgs/tools/misc/tbls/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

58 lines
1.4 KiB
Nix
Raw Normal View History

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";
2024-01-13 01:51:41 +00:00
version = "1.72.1";
2022-09-03 23:23:15 +00:00
src = fetchFromGitHub {
owner = "k1LoW";
repo = "tbls";
rev = "v${version}";
2024-01-13 01:51:41 +00:00
hash = "sha256-ZkJ1+o4xWQX63/2hdhnE5hyVrZIn1O2kmaiZ1853X/8=";
2022-09-03 23:23:15 +00:00
};
2024-01-13 01:51:41 +00:00
vendorHash = "sha256-IczwqqCQeTpXiDSJxX8ErmO4Ap+coIRAQTmRoDNtdXs=";
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
};
}