2022-03-26 13:37:36 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildGoModule
|
|
|
|
, runCommand
|
|
|
|
, nix-update-script
|
2022-04-28 13:45:54 +00:00
|
|
|
, fetchurl
|
2022-04-20 14:40:48 +00:00
|
|
|
, testers
|
2022-04-28 13:45:54 +00:00
|
|
|
, python3
|
|
|
|
, curl
|
|
|
|
, jq
|
2022-06-21 13:55:51 +00:00
|
|
|
, p7zip
|
2022-04-28 13:45:54 +00:00
|
|
|
, dsq
|
2022-03-26 13:37:36 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "dsq";
|
2022-10-21 05:32:57 +00:00
|
|
|
version = "0.23.0";
|
2022-03-26 13:37:36 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "multiprocessio";
|
|
|
|
repo = "dsq";
|
2022-08-28 10:39:38 +00:00
|
|
|
rev = "v${version}";
|
2022-10-21 05:32:57 +00:00
|
|
|
hash = "sha256-FZBJe+2y4HV3Pgeap4yvD0a8M/j+6pAJEFpoQVVE1ec=";
|
2022-03-26 13:37:36 +00:00
|
|
|
};
|
|
|
|
|
2022-10-21 05:32:57 +00:00
|
|
|
vendorSha256 = "sha256-MbBR+OC1OGhZZGcZqc+Jzmabdc5ZfFEwzqP5YMrj6mY=";
|
2022-03-26 13:37:36 +00:00
|
|
|
|
2022-04-11 15:42:29 +00:00
|
|
|
ldflags = [ "-X" "main.Version=${version}" ];
|
|
|
|
|
2022-06-21 13:55:51 +00:00
|
|
|
checkInputs = [ python3 curl jq p7zip ];
|
2022-04-28 13:45:54 +00:00
|
|
|
|
2022-06-21 13:55:51 +00:00
|
|
|
preCheck = ''
|
|
|
|
substituteInPlace scripts/test.py \
|
|
|
|
--replace 'dsq latest' 'dsq ${version}'
|
|
|
|
'';
|
2022-04-28 13:45:54 +00:00
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
2022-06-21 13:55:51 +00:00
|
|
|
7z e testdata/taxi.csv.7z
|
2022-04-28 13:45:54 +00:00
|
|
|
cp "$GOPATH/bin/dsq" .
|
|
|
|
python3 scripts/test.py
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
2022-03-26 13:37:36 +00:00
|
|
|
passthru = {
|
2022-12-25 22:11:14 +00:00
|
|
|
updateScript = nix-update-script { };
|
2022-03-26 13:37:36 +00:00
|
|
|
|
2022-04-28 13:45:54 +00:00
|
|
|
tests.version = testers.testVersion { package = dsq; };
|
2022-03-26 13:37:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Commandline tool for running SQL queries against JSON, CSV, Excel, Parquet, and more";
|
|
|
|
homepage = "https://github.com/multiprocessio/dsq";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ liff ];
|
|
|
|
};
|
|
|
|
}
|