Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv 2, lib 3, rustPlatform 4, fetchFromGitHub 5, installShellFiles 6, pkg-config 7, openssl 8, libiconv 9, testers 10, sqlx-cli 11, CoreFoundation 12, Security 13, SystemConfiguration 14, nix-update-script 15}: 16 17rustPlatform.buildRustPackage rec { 18 pname = "sqlx-cli"; 19 version = "0.7.4"; 20 21 src = fetchFromGitHub { 22 owner = "launchbadge"; 23 repo = "sqlx"; 24 rev = "v${version}"; 25 hash = "sha256-q1o2pNKfvenpRwiYgIKkOYNcajgIhrhCjFC7bbEyLE4="; 26 }; 27 28 cargoHash = "sha256-sMyK1v4pJmmlN47mvgUkpLBjcpmT346VSp984IpvVWY="; 29 30 buildNoDefaultFeatures = true; 31 buildFeatures = [ 32 "native-tls" 33 "postgres" 34 "sqlite" 35 "mysql" 36 "completions" 37 ]; 38 39 doCheck = false; 40 cargoBuildFlags = [ "--package sqlx-cli" ]; 41 42 nativeBuildInputs = [ 43 installShellFiles 44 pkg-config 45 ]; 46 47 buildInputs = 48 lib.optionals stdenv.isLinux [ 49 openssl 50 ] ++ 51 lib.optionals stdenv.isDarwin [ 52 CoreFoundation 53 Security 54 SystemConfiguration 55 libiconv 56 ]; 57 58 postInstall = '' 59 for shell in bash fish zsh; do 60 $out/bin/sqlx completions $shell > sqlx.$shell 61 installShellCompletion sqlx.$shell 62 done 63 ''; 64 65 passthru.tests.version = testers.testVersion { 66 package = sqlx-cli; 67 command = "sqlx --version"; 68 }; 69 70 passthru.updateScript = nix-update-script { }; 71 72 meta = with lib; { 73 description = 74 "SQLx's associated command-line utility for managing databases, migrations, and enabling offline mode with sqlx::query!() and friends."; 75 homepage = "https://github.com/launchbadge/sqlx"; 76 license = licenses.asl20; 77 maintainers = with maintainers; [ greizgh xrelkd fd ]; 78 mainProgram = "sqlx"; 79 }; 80}