depot/third_party/nixpkgs/pkgs/tools/misc/dsq/default.nix
Default email d56f44df06 Project import generated by Copybara.
GitOrigin-RevId: bc4b9eef3ce3d5a90d8693e8367c9cbfc9fc1e13
2022-04-03 20:54:34 +02:00

60 lines
1.5 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, buildGoModule
, runCommand
, nix-update-script
, dsq
, diffutils
}:
buildGoModule rec {
pname = "dsq";
version = "0.11.0";
src = fetchFromGitHub {
owner = "multiprocessio";
repo = "dsq";
rev = version;
hash = "sha256-4g9fu5taFtb7VzVa0X8s6SbEO9qTFD0ff+CVJpr376c=";
};
vendorSha256 = "sha256-YPH/uPPNT1byXOtCrNyU68H4mHO8arl6l5hs9WMcxVk=";
nativeBuildInputs = [ diffutils ];
passthru = {
updateScript = nix-update-script { attrPath = pname; };
tests = {
pretty-csv = runCommand "${pname}-test" { } ''
mkdir "$out"
cat <<EOF > "$out/input.csv"
first,second
1,a
2,b
EOF
cat <<EOF > "$out/expected.txt"
+-------+--------+
| first | second |
+-------+--------+
| 1 | a |
| 2 | b |
+-------+--------+
EOF
${dsq}/bin/dsq --pretty "$out/input.csv" 'select first, second from {}' > "$out/actual.txt"
diff "$out/expected.txt" "$out/actual.txt"
'';
};
};
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 ];
# TODO: Remove once nixpkgs uses macOS SDK 10.14+ for x86_64-darwin
# Undefined symbols for architecture x86_64: "_SecTrustEvaluateWithError"
broken = stdenv.isDarwin && stdenv.isx86_64;
};
}