1{ darwin
2, fetchFromGitHub
3, lib
4, libiconv
5, libpg_query
6, openssl
7, pkg-config
8, rustPlatform
9, stdenv
10}:
11
12rustPlatform.buildRustPackage rec {
13 pname = "squawk";
14 version = "0.28.0";
15
16 src = fetchFromGitHub {
17 owner = "sbdchd";
18 repo = pname;
19 rev = "v${version}";
20 hash = "sha256-RnY41G0ombqJewv+kxvg8AwQeRaVb+frZjmU/Cd28Jo=";
21 };
22
23 cargoHash = "sha256-YR2ZSwrCkX8eyHTj1Dtk9f01/y9fDtknouige68kS8I=";
24
25 nativeBuildInputs = [
26 pkg-config
27 rustPlatform.bindgenHook
28 ];
29
30 buildInputs = lib.optionals (!stdenv.isDarwin) [
31 libiconv
32 openssl
33 ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
34 CoreFoundation
35 Security
36 ]);
37
38 OPENSSL_NO_VENDOR = 1;
39
40 LIBPG_QUERY_PATH = libpg_query;
41
42 checkFlags = [
43 # depends on the PostgreSQL version
44 "--skip=parse::tests::test_parse_sql_query_json"
45 ];
46
47 meta = with lib; {
48 description = "Linter for PostgreSQL, focused on migrations";
49 homepage = "https://squawkhq.com/";
50 changelog = "https://github.com/sbdchd/squawk/blob/v${version}/CHANGELOG.md";
51 license = licenses.gpl3Only;
52 maintainers = with lib.maintainers; [ andrewsmith ];
53 };
54}