nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildGoModule,
5 fetchFromGitHub,
6 installShellFiles,
7 buildPackages,
8 versionCheckHook,
9 nix-update-script,
10}:
11buildGoModule rec {
12 pname = "xlsxsql";
13 version = "0.4.0";
14
15 src = fetchFromGitHub {
16 owner = "noborus";
17 repo = "xlsxsql";
18 tag = "v${version}";
19 hash = "sha256-OmNYrohWs4l7cReTBB6Ha9VuKPit1+P7a4QKhYwK5g8=";
20 };
21
22 vendorHash = "sha256-Zrt4NMoQePvipFyYpN+Ipgl2D6j/thCPhrQy4AbXOfQ=";
23
24 ldflags = [
25 "-X main.version=v${version}"
26 "-X main.revision=${src.rev}"
27 ];
28
29 nativeBuildInputs = [
30 installShellFiles
31 ];
32
33 postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (
34 let
35 emulator = stdenv.hostPlatform.emulator buildPackages;
36 in
37 ''
38 installShellCompletion --cmd xlsxsql \
39 --bash <(${emulator} $out/bin/xlsxsql completion bash) \
40 --fish <(${emulator} $out/bin/xlsxsql completion fish) \
41 --zsh <(${emulator} $out/bin/xlsxsql completion zsh)
42 ''
43 );
44
45 nativeInstallCheckInputs = [
46 versionCheckHook
47 ];
48 doInstallCheck = true;
49
50 passthru.updateScript = nix-update-script { };
51
52 meta = {
53 description = "CLI tool that executes SQL queries on various files including xlsx files and outputs the results to various files";
54 homepage = "https://github.com/noborus/xlsxsql";
55 changelog = "https://github.com/noborus/xlsxsql/releases/tag/v${version}";
56 license = lib.licenses.mit;
57 maintainers = with lib.maintainers; [ xiaoxiangmoe ];
58 mainProgram = "xlsxsql";
59 };
60}