From 9adfaee104f3d0a3b639eab5b7ef8d7cbca5320b Mon Sep 17 00:00:00 2001 From: xrelkd <46590321+xrelkd@users.noreply.github.com> Date: Fri, 21 Jul 2023 10:41:51 +0800 Subject: [PATCH 1/2] sqlx-cli: install shell completions --- .../tools/rust/sqlx-cli/default.nix | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/pkgs/development/tools/rust/sqlx-cli/default.nix b/pkgs/development/tools/rust/sqlx-cli/default.nix index 70973a455632..5d640890f0ec 100644 --- a/pkgs/development/tools/rust/sqlx-cli/default.nix +++ b/pkgs/development/tools/rust/sqlx-cli/default.nix @@ -2,14 +2,15 @@ , lib , rustPlatform , fetchFromGitHub +, installShellFiles , pkg-config , openssl -, SystemConfiguration -, CoreFoundation -, Security , libiconv , testers , sqlx-cli +, CoreFoundation +, Security +, SystemConfiguration }: rustPlatform.buildRustPackage rec { @@ -28,9 +29,26 @@ rustPlatform.buildRustPackage rec { doCheck = false; cargoBuildFlags = [ "-p sqlx-cli" ]; - nativeBuildInputs = [ pkg-config ]; - buildInputs = lib.optionals stdenv.isLinux [ openssl ] - ++ lib.optionals stdenv.isDarwin [ SystemConfiguration CoreFoundation Security libiconv ]; + nativeBuildInputs = [ + installShellFiles + pkg-config + ]; + + buildInputs = + lib.optionals stdenv.isLinux [ openssl ] + ++ lib.optionals stdenv.isDarwin [ + CoreFoundation + Security + SystemConfiguration + libiconv + ]; + + postInstall = '' + for shell in bash fish zsh; do + $out/bin/sqlx completions $shell > sqlx.$shell + installShellCompletion sqlx.$shell + done + ''; passthru.tests.version = testers.testVersion { package = sqlx-cli; From a0465cdf054a9476898a87301350ee467955ed09 Mon Sep 17 00:00:00 2001 From: xrelkd <46590321+xrelkd@users.noreply.github.com> Date: Fri, 21 Jul 2023 12:06:41 +0800 Subject: [PATCH 2/2] sqlx-cli: replace `native-tls` with `rustls` --- .../development/tools/rust/sqlx-cli/default.nix | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/pkgs/development/tools/rust/sqlx-cli/default.nix b/pkgs/development/tools/rust/sqlx-cli/default.nix index 5d640890f0ec..74da630ff938 100644 --- a/pkgs/development/tools/rust/sqlx-cli/default.nix +++ b/pkgs/development/tools/rust/sqlx-cli/default.nix @@ -4,7 +4,6 @@ , fetchFromGitHub , installShellFiles , pkg-config -, openssl , libiconv , testers , sqlx-cli @@ -27,21 +26,19 @@ rustPlatform.buildRustPackage rec { cargoHash = "sha256-X7fLbih1s3sxn8vb2kQeFUKDK2DlC+sjm9ZTwj3FD1Y="; doCheck = false; - cargoBuildFlags = [ "-p sqlx-cli" ]; + cargoBuildFlags = [ "--package sqlx-cli --no-default-features --features rustls,postgres,sqlite,mysql,completions" ]; nativeBuildInputs = [ installShellFiles pkg-config ]; - buildInputs = - lib.optionals stdenv.isLinux [ openssl ] - ++ lib.optionals stdenv.isDarwin [ - CoreFoundation - Security - SystemConfiguration - libiconv - ]; + buildInputs = lib.optionals stdenv.isDarwin [ + CoreFoundation + Security + SystemConfiguration + libiconv + ]; postInstall = '' for shell in bash fish zsh; do