2022-03-30 09:31:56 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildGoModule
|
|
|
|
, runCommand
|
|
|
|
, nix-update-script
|
2022-04-27 09:35:20 +00:00
|
|
|
, fetchurl
|
|
|
|
, testers
|
|
|
|
, python3
|
|
|
|
, curl
|
|
|
|
, jq
|
2022-06-26 10:26:21 +00:00
|
|
|
, p7zip
|
2022-03-30 09:31:56 +00:00
|
|
|
, dsq
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "dsq";
|
2022-07-14 12:49:19 +00:00
|
|
|
version = "0.21.0";
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "multiprocessio";
|
|
|
|
repo = "dsq";
|
|
|
|
rev = version;
|
2022-07-14 12:49:19 +00:00
|
|
|
hash = "sha256-jwJw56Z/Y0vnsybE/FfXXHtz0W0J80Q5rrRRoINbjkM=";
|
2022-03-30 09:31:56 +00:00
|
|
|
};
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
vendorSha256 = "sha256-7KQDaDM151OFfTYRPOit4MAmwgEzvLOYFWCjXhVmFT0=";
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
ldflags = [ "-X" "main.Version=${version}" ];
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
checkInputs = [ python3 curl jq p7zip ];
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
preCheck = ''
|
|
|
|
substituteInPlace scripts/test.py \
|
|
|
|
--replace 'dsq latest' 'dsq ${version}'
|
|
|
|
'';
|
2022-04-27 09:35:20 +00:00
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
7z e testdata/taxi.csv.7z
|
2022-04-27 09:35:20 +00:00
|
|
|
cp "$GOPATH/bin/dsq" .
|
|
|
|
python3 scripts/test.py
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
2022-03-30 09:31:56 +00:00
|
|
|
|
|
|
|
passthru = {
|
|
|
|
updateScript = nix-update-script { attrPath = pname; };
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
tests.version = testers.testVersion { package = dsq; };
|
2022-03-30 09:31:56 +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 ];
|
|
|
|
};
|
|
|
|
}
|