dsq: init at 0.9.0

This commit is contained in:
Olli Helenius 2022-03-26 15:37:36 +02:00
parent a7fddda828
commit 9e9ec58470
No known key found for this signature in database
GPG Key ID: 67235CC88F41DE3C
2 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,60 @@
{ lib
, stdenv
, fetchFromGitHub
, buildGoModule
, runCommand
, nix-update-script
, dsq
, diffutils
}:
buildGoModule rec {
pname = "dsq";
version = "0.9.0";
src = fetchFromGitHub {
owner = "multiprocessio";
repo = "dsq";
rev = version;
hash = "sha256-JzS94kfvgZDz4tIXa4veY3XSFeMDBN61sU8/+5V5y9Y=";
};
vendorSha256 = "sha256-9Exy2VLxOd4lgwbIOZ6NJ45NABO9a0rLjmZ+Cd7jjLM=";
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;
};
}

View File

@ -341,6 +341,8 @@ with pkgs;
deadnix = callPackage ../development/tools/deadnix { };
dsq = callPackage ../tools/misc/dsq { buildGoModule = buildGo118Module; };
each = callPackage ../tools/text/each { };
eclipse-mat = callPackage ../development/tools/eclipse-mat { };