nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 buildGoModule,
5 nix-update-script,
6 testers,
7 python3,
8 curl,
9 jq,
10 p7zip,
11 dsq,
12}:
13
14buildGoModule rec {
15 pname = "dsq";
16 version = "0.23.0";
17
18 src = fetchFromGitHub {
19 owner = "multiprocessio";
20 repo = "dsq";
21 rev = "v${version}";
22 hash = "sha256-FZBJe+2y4HV3Pgeap4yvD0a8M/j+6pAJEFpoQVVE1ec=";
23 };
24
25 vendorHash = "sha256-MbBR+OC1OGhZZGcZqc+Jzmabdc5ZfFEwzqP5YMrj6mY=";
26
27 ldflags = [
28 "-X"
29 "main.Version=${version}"
30 ];
31
32 nativeCheckInputs = [
33 python3
34 curl
35 jq
36 p7zip
37 ];
38
39 preCheck = ''
40 substituteInPlace scripts/test.py \
41 --replace 'dsq latest' 'dsq ${version}'
42 '';
43
44 checkPhase = ''
45 runHook preCheck
46
47 7z e testdata/taxi.csv.7z
48 cp "$GOPATH/bin/dsq" .
49 python3 scripts/test.py
50
51 runHook postCheck
52 '';
53
54 passthru = {
55 updateScript = nix-update-script { };
56
57 tests.version = testers.testVersion { package = dsq; };
58 };
59
60 meta = {
61 mainProgram = "dsq";
62 description = "Commandline tool for running SQL queries against JSON, CSV, Excel, Parquet, and more";
63 homepage = "https://github.com/multiprocessio/dsq";
64 license = lib.licenses.asl20;
65 maintainers = with lib.maintainers; [ liff ];
66 };
67}