@@ -0,0 +1,56 @@
1+{ lib
2+, fetchFromGitHub
3+, buildGoModule
4+, unixODBC
5+, icu
6+}:
7+
8+buildGoModule rec {
9+ pname = "usql";
10+ version = "0.9.1";
11+
12+ src = fetchFromGitHub {
13+ owner = "xo";
14+ repo = "usql";
15+ rev = "v${version}";
16+ sha256 = "sha256-fcKn4kHIRvMdgGFKDNQg49YxLc0Y5j/8VwKoDLiXbEU=";
17+ };
18+
19+ vendorSha256 = "sha256-uAV8NLnqXjIDILfnbbkVr2BOIucQ8vX89KI5yIkVtus=";
20+
21+ buildInputs = [ unixODBC icu ];
22+
23+ # These tags and flags are copied from build-release.sh
24+ buildFlags = [ "-tags" ];
25+ buildFlagsArray = [
26+ "most"
27+ "sqlite_app_armor"
28+ "sqlite_fts5"
29+ "sqlite_introspect"
30+ "sqlite_json1"
31+ "sqlite_stat4"
32+ "sqlite_userauth"
33+ "sqlite_vtable"
34+ "sqlite_icu"
35+ "no_adodb"
36+ ];
37+
38+ ldflags = [
39+ "-s"
40+ "-w"
41+ "-X github.com/xo/usql/text.CommandVersion=${version}"
42+ ];
43+
44+ # All the checks currently require docker instances to run the databases.
45+ doCheck = false;
46+
47+ meta = with lib; {
48+ description = "Universal command-line interface for SQL databases";
49+ homepage = "https://github.com/xo/usql";
50+ license = licenses.mit;
51+ maintainers = with maintainers; [ georgyo ];
52+ # usql does not build on ARM.
53+ platforms = [ "x86_64-linux" "x86_64-darwin" ];
54+ };
55+
56+}