1{ lib
2, rustPlatform
3, fetchFromGitHub
4, pkg-config
5, openssl
6, sqlite
7, zlib
8, stdenv
9, darwin
10, python3
11}:
12
13rustPlatform.buildRustPackage rec {
14 pname = "prqlc";
15 version = "0.11.4";
16
17 src = fetchFromGitHub {
18 owner = "prql";
19 repo = "prql";
20 rev = version;
21 hash = "sha256-YQqGy6BadoTjlCrF7N2PhxmXyuNa6V4sFHRphxQfF4o=";
22 };
23
24 cargoHash = "sha256-0UEbg6f+9eew5RxmuPsOrtiSBsP9mPMO8h5mJEeTFFU=";
25
26 nativeBuildInputs = [
27 pkg-config
28 rustPlatform.bindgenHook
29 ];
30
31 buildInputs =
32 [
33 openssl
34 sqlite
35 zlib
36 ]
37 ++ lib.optionals stdenv.isDarwin [
38 darwin.apple_sdk.frameworks.CoreFoundation
39 darwin.apple_sdk.frameworks.CoreServices
40 darwin.apple_sdk.frameworks.Security
41 ];
42
43 env = {
44 PYO3_PYTHON = "${python3}/bin/python3";
45 };
46
47 # we are only interested in the prqlc binary
48 postInstall = ''
49 rm -r $out/bin/compile-files $out/bin/mdbook-prql $out/lib
50 '';
51
52 meta = with lib; {
53 description = "A CLI for the PRQL compiler - a simple, powerful, pipelined SQL replacement";
54 homepage = "https://github.com/prql/prql";
55 changelog = "https://github.com/prql/prql/blob/${src.rev}/CHANGELOG.md";
56 license = licenses.asl20;
57 maintainers = with maintainers; [ dit7ya ];
58 };
59}