19 postgresqlSupport ? true,
22 assert lib.assertMsg (lib.elem true [
26 ]) "support for at least one database must be enabled";
28 rustPlatform.buildRustPackage rec {
34 crateName = "diesel_cli";
35 hash = "sha256-kTwAG1B4gy+1jj5ar5RkmIUMAO9wYsG7QnMcZii/OZk=";
38 cargoHash = "sha256-qcyNFuKJldHVJDAye4K1rHPf/SvpZ+BmqBast1vh/3Q=";
47 ++ lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.Security
48 ++ lib.optional (stdenv.hostPlatform.isDarwin && mysqlSupport) libiconv
49 ++ lib.optional sqliteSupport sqlite
50 ++ lib.optional postgresqlSupport postgresql
51 ++ lib.optionals mysqlSupport [
56 buildNoDefaultFeatures = true;
58 lib.optional sqliteSupport "sqlite"
59 ++ lib.optional postgresqlSupport "postgres"
60 ++ lib.optional mysqlSupport "mysql";
63 # all of these require a live database to be running
64 # `DATABASE_URL must be set in order to run tests: NotPresent`
65 "--skip=infer_schema_internals::information_schema::tests::get_primary_keys_only_includes_primary_key"
66 "--skip=infer_schema_internals::information_schema::tests::load_table_names_loads_from_custom_schema"
67 "--skip=infer_schema_internals::information_schema::tests::load_table_names_loads_from_public_schema_if_none_given"
68 "--skip=infer_schema_internals::information_schema::tests::load_table_names_output_is_ordered"
69 "--skip=infer_schema_internals::information_schema::tests::skip_views"
70 "--skip=infer_schema_internals::mysql::test::get_table_data_loads_column_information"
71 "--skip=infer_schema_internals::mysql::test::gets_table_comment"
72 "--skip=infer_schema_internals::pg::test::get_foreign_keys_loads_foreign_keys"
73 "--skip=infer_schema_internals::pg::test::get_foreign_keys_loads_foreign_keys_with_same_name"
74 "--skip=infer_schema_internals::pg::test::get_table_data_loads_column_information"
75 "--skip=infer_schema_internals::pg::test::gets_table_comment"
77 cargoCheckFeatures = buildFeatures;
79 # Tests currently fail due to *many* duplicate definition errors
82 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
83 installShellCompletion --cmd diesel \
84 --bash <($out/bin/diesel completions bash) \
85 --fish <($out/bin/diesel completions fish) \
86 --zsh <($out/bin/diesel completions zsh)
89 # Fix the build with mariadb, which otherwise shows "error adding symbols:
90 # DSO missing from command line" errors for libz and libssl.
91 env.NIX_LDFLAGS = lib.optionalString mysqlSupport "-lz -lssl -lcrypto";
94 tests.version = testers.testVersion { package = diesel-cli; };
95 updateScript = nix-update-script { };
99 description = "Database tool for working with Rust projects that use Diesel";
100 homepage = "https://diesel.rs";
101 changelog = "https://github.com/diesel-rs/diesel/releases/tag/v${version}";
102 license = with lib.licenses; [
106 maintainers = with lib.maintainers; [ getchoo ];
107 mainProgram = "diesel";