blob: 9d3526ee9d53a855f3e0b0ca2c18a88862ef5926 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
{ darwin
, fetchFromGitHub
, lib
, libiconv
, libpg_query
, openssl
, pkg-config
, rustPlatform
, stdenv
}:
let
# The query parser produces a slightly different AST between major versions
# and Squawk is not capable of handling >=14 correctly yet.
libpg_query13 = libpg_query.overrideAttrs (_: rec {
version = "13-2.2.0";
src = fetchFromGitHub {
owner = "pganalyze";
repo = "libpg_query";
rev = version;
hash = "sha256-gEkcv/j8ySUYmM9lx1hRF/SmuQMYVHwZAIYOaCQWAFs=";
};
});
in
rustPlatform.buildRustPackage rec {
pname = "squawk";
version = "0.21.0";
src = fetchFromGitHub {
owner = "sbdchd";
repo = pname;
rev = "v${version}";
hash = "sha256-ObaYGGTAGGLOAji86Q5R9fqbCGg6GP0A3iheNLgzezY=";
};
cargoHash = "sha256-VOGgwBKcJK7x+PwvzvuVu9Zd1G8t9UoC/Me3G6bdtrk=";
cargoPatches = [
./correct-Cargo.lock.patch
];
patches = [
./fix-postgresql-version-in-snapshot-test.patch
];
nativeBuildInputs = [
pkg-config
rustPlatform.bindgenHook
];
buildInputs = lib.optionals (!stdenv.isDarwin) [
libiconv
openssl
] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
CoreFoundation
Security
]);
OPENSSL_NO_VENDOR = 1;
LIBPG_QUERY_PATH = libpg_query13;
meta = with lib; {
description = "Linter for PostgreSQL, focused on migrations";
homepage = "https://squawkhq.com/";
changelog = "https://github.com/sbdchd/squawk/blob/v${version}/CHANGELOG.md";
license = licenses.gpl3Only;
maintainers = with lib.maintainers; [ andrewsmith ];
};
}
|