2022-12-17 10:02:37 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
2023-08-04 22:07:22 +00:00
|
|
|
, installShellFiles
|
2022-12-17 10:02:37 +00:00
|
|
|
, pkg-config
|
2023-10-09 19:29:22 +00:00
|
|
|
, openssl
|
2022-12-17 10:02:37 +00:00
|
|
|
, libiconv
|
|
|
|
, testers
|
|
|
|
, sqlx-cli
|
2023-08-04 22:07:22 +00:00
|
|
|
, CoreFoundation
|
|
|
|
, Security
|
|
|
|
, SystemConfiguration
|
2024-02-29 20:09:43 +00:00
|
|
|
, nix-update-script
|
2022-12-17 10:02:37 +00:00
|
|
|
}:
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "sqlx-cli";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "0.7.4";
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "launchbadge";
|
|
|
|
repo = "sqlx";
|
|
|
|
rev = "v${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-q1o2pNKfvenpRwiYgIKkOYNcajgIhrhCjFC7bbEyLE4=";
|
2021-02-05 17:12:51 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
cargoHash = "sha256-sMyK1v4pJmmlN47mvgUkpLBjcpmT346VSp984IpvVWY=";
|
2024-01-13 08:15:51 +00:00
|
|
|
|
|
|
|
buildNoDefaultFeatures = true;
|
|
|
|
buildFeatures = [
|
|
|
|
"native-tls"
|
|
|
|
"postgres"
|
|
|
|
"sqlite"
|
|
|
|
"mysql"
|
|
|
|
"completions"
|
|
|
|
];
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
doCheck = false;
|
2024-01-13 08:15:51 +00:00
|
|
|
cargoBuildFlags = [ "--package sqlx-cli" ];
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
buildInputs =
|
|
|
|
lib.optionals stdenv.isLinux [
|
|
|
|
openssl
|
|
|
|
] ++
|
|
|
|
lib.optionals stdenv.isDarwin [
|
|
|
|
CoreFoundation
|
|
|
|
Security
|
|
|
|
SystemConfiguration
|
|
|
|
libiconv
|
|
|
|
];
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
postInstall = ''
|
|
|
|
for shell in bash fish zsh; do
|
|
|
|
$out/bin/sqlx completions $shell > sqlx.$shell
|
|
|
|
installShellCompletion sqlx.$shell
|
|
|
|
done
|
|
|
|
'';
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = sqlx-cli;
|
|
|
|
command = "sqlx --version";
|
|
|
|
};
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description =
|
|
|
|
"SQLx's associated command-line utility for managing databases, migrations, and enabling offline mode with sqlx::query!() and friends.";
|
|
|
|
homepage = "https://github.com/launchbadge/sqlx";
|
|
|
|
license = licenses.asl20;
|
2023-08-04 22:07:22 +00:00
|
|
|
maintainers = with maintainers; [ greizgh xrelkd fd ];
|
2023-08-22 20:05:09 +00:00
|
|
|
mainProgram = "sqlx";
|
2021-02-05 17:12:51 +00:00
|
|
|
};
|
|
|
|
}
|