From 9e9ec58470b0d47f3a8c61d20539afa382d711b6 Mon Sep 17 00:00:00 2001 From: Olli Helenius Date: Sat, 26 Mar 2022 15:37:36 +0200 Subject: [PATCH] dsq: init at 0.9.0 --- pkgs/tools/misc/dsq/default.nix | 60 +++++++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 62 insertions(+) create mode 100644 pkgs/tools/misc/dsq/default.nix diff --git a/pkgs/tools/misc/dsq/default.nix b/pkgs/tools/misc/dsq/default.nix new file mode 100644 index 000000000000..2451800b41f9 --- /dev/null +++ b/pkgs/tools/misc/dsq/default.nix @@ -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 < "$out/input.csv" + first,second + 1,a + 2,b + EOF + cat < "$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; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5a3c993705ce..29aa67d295e1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };