nixpkgs/pkgs/tools/misc/dsq/default.nix

61 lines
1.2 KiB
Nix
Raw Normal View History

2022-03-26 13:37:36 +00:00
{ lib
, stdenv
, fetchFromGitHub
, buildGoModule
, runCommand
, nix-update-script
, fetchurl
, testers
, python3
, curl
, jq
2022-06-21 13:55:51 +00:00
, p7zip
, 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";
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
ldflags = [ "-X" "main.Version=${version}" ];
2022-06-21 13:55:51 +00:00
checkInputs = [ python3 curl jq p7zip ];
2022-06-21 13:55:51 +00:00
preCheck = ''
substituteInPlace scripts/test.py \
--replace 'dsq latest' 'dsq ${version}'
'';
checkPhase = ''
runHook preCheck
2022-06-21 13:55:51 +00:00
7z e testdata/taxi.csv.7z
cp "$GOPATH/bin/dsq" .
python3 scripts/test.py
runHook postCheck
'';
2022-03-26 13:37:36 +00:00
passthru = {
updateScript = nix-update-script { };
2022-03-26 13:37:36 +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 ];
};
}