1{ stdenv, lib, rustPlatform, fetchFromGitHub, pkg-config, openssl, SystemConfiguration, CoreFoundation, Security, libiconv, testers, sqlx-cli }:
2
3rustPlatform.buildRustPackage rec {
4 pname = "sqlx-cli";
5 version = "0.6.2";
6
7 src = fetchFromGitHub {
8 owner = "launchbadge";
9 repo = "sqlx";
10 rev = "v${version}";
11 sha256 = "sha256-pQlrKjhOJfjNEmLxqnFmmBY1naheZUsaq2tGdLKGxjg=";
12 };
13
14 cargoSha256 = "sha256-AbA8L7rkyZfKW0vvjyrcW5eU6jGD+zAqIcEUOJmeqJs=";
15
16 doCheck = false;
17 cargoBuildFlags = [ "-p sqlx-cli" ];
18
19 nativeBuildInputs = [ pkg-config ];
20 buildInputs = lib.optionals stdenv.isLinux [ openssl ]
21 ++ lib.optionals stdenv.isDarwin [ SystemConfiguration CoreFoundation Security libiconv ];
22
23 passthru.tests.version = testers.testVersion {
24 package = sqlx-cli;
25 command = "sqlx --version";
26 };
27
28 meta = with lib; {
29 description =
30 "SQLx's associated command-line utility for managing databases, migrations, and enabling offline mode with sqlx::query!() and friends.";
31 homepage = "https://github.com/launchbadge/sqlx";
32 license = licenses.asl20;
33 maintainers = with maintainers; [ greizgh ];
34 };
35}