1{
2 lib,
3 fetchFromGitHub,
4 buildGoModule,
5 unixODBC,
6 icu,
7 nix-update-script,
8 testers,
9 usql,
10}:
11
12buildGoModule rec {
13 pname = "usql";
14 version = "0.19.21";
15
16 src = fetchFromGitHub {
17 owner = "xo";
18 repo = "usql";
19 tag = "v${version}";
20 hash = "sha256-Ix1+uq5TpYp6JyT2KML8Ts/ElPeQCKz9qAW9DqQahbE=";
21 };
22
23 buildInputs = [
24 unixODBC
25 icu
26 ];
27
28 vendorHash = "sha256-YXpmzIPs6gvEspC9JrGHw4Yzs8wdtBTsGU9kTOT6c+0=";
29 proxyVendor = true;
30
31 # Exclude drivers from the bad group
32 # These drivers break too often and are not used.
33 #
34 excludedPackages = [
35 "impala"
36 ];
37
38 # These tags and flags are copied from build.sh
39 tags = [
40 "most"
41 "sqlite_app_armor"
42 "sqlite_fts5"
43 "sqlite_introspect"
44 "sqlite_json1"
45 "sqlite_math_functions"
46 "sqlite_stat4"
47 "sqlite_userauth"
48 "sqlite_vtable"
49 "no_adodb"
50 ];
51
52 ldflags = [
53 "-s"
54 "-w"
55 "-X github.com/xo/usql/text.CommandVersion=${version}"
56 ];
57
58 # All the checks currently require docker instances to run the databases.
59 doCheck = false;
60
61 passthru = {
62 updateScript = nix-update-script { };
63 tests.version = testers.testVersion {
64 inherit version;
65 package = usql;
66 command = "usql --version";
67 };
68 };
69
70 meta = {
71 description = "Universal command-line interface for SQL databases";
72 homepage = "https://github.com/xo/usql";
73 changelog = "https://github.com/xo/usql/releases/tag/v${version}";
74 license = lib.licenses.mit;
75 mainProgram = "usql";
76 maintainers = with lib.maintainers; [
77 georgyo
78 anthonyroussel
79 ];
80 platforms = with lib.platforms; linux ++ darwin;
81 };
82}