Merge pull request #165927 from liff/init/dsq
This commit is contained in:
commit
70148dac41
60
pkgs/tools/misc/dsq/default.nix
Normal file
60
pkgs/tools/misc/dsq/default.nix
Normal 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;
|
||||
};
|
||||
}
|
@ -343,6 +343,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 { };
|
||||
|
Loading…
Reference in New Issue
Block a user