about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/diesel-cli/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/tools/diesel-cli/default.nix')
-rw-r--r--nixpkgs/pkgs/development/tools/diesel-cli/default.nix53
1 files changed, 29 insertions, 24 deletions
diff --git a/nixpkgs/pkgs/development/tools/diesel-cli/default.nix b/nixpkgs/pkgs/development/tools/diesel-cli/default.nix
index bd8e71090c53..8a976f44bf72 100644
--- a/nixpkgs/pkgs/development/tools/diesel-cli/default.nix
+++ b/nixpkgs/pkgs/development/tools/diesel-cli/default.nix
@@ -1,7 +1,7 @@
 { stdenv, lib, rustPlatform, fetchFromGitHub, openssl, pkg-config, Security
 , sqliteSupport ? true, sqlite
 , postgresqlSupport ? true, postgresql
-, mysqlSupport ? true, mysql, zlib, libiconv
+, mysqlSupport ? true, mariadb, zlib, libiconv
 }:
 
 assert lib.assertMsg (sqliteSupport == true || postgresqlSupport == true || mysqlSupport == true)
@@ -9,50 +9,55 @@ assert lib.assertMsg (sqliteSupport == true || postgresqlSupport == true || mysq
 
 let
   inherit (lib) optional optionals optionalString;
-  features = ''
-    ${optionalString sqliteSupport "sqlite"} \
-    ${optionalString postgresqlSupport "postgres"} \
-    ${optionalString mysqlSupport "mysql"} \
-  '';
+  features = optional sqliteSupport "sqlite"
+    ++ optional postgresqlSupport "postgres"
+    ++ optional mysqlSupport "mysql";
 in
 
 rustPlatform.buildRustPackage rec {
   pname = "diesel-cli";
-  version = "1.4.0";
+  version = "1.4.1";
 
   src = fetchFromGitHub {
     owner = "diesel-rs";
     repo = "diesel";
-    rev = "v${version}";
-    sha256 = "0wp4hvpl9cf8hw1jyz3z476k5blrh6srfpv36dw10bj126rz9pvb";
+    # diesel and diesel_cli are independently versioned. diesel_cli
+    # 1.4.1 first became available in diesel 1.4.5, but we can use
+    # a newer diesel tag.
+    rev = "v1.4.6";
+    sha256 = "0c8a2f250mllzpr20j7j0msbf2csjf9dj8g7j6cl04ifdg7gwb9z";
   };
 
   patches = [
-    # Allow warnings to fix many instances of `error: trait objects without an explicit `dyn` are deprecated`
-    #
-    # Remove this after https://github.com/diesel-rs/diesel/commit/9004d1c3fa12aaee84986bd3d893002491373f8c
-    # is in a release.
-    ./allow-warnings.patch
+    # Fixes:
+    #    Compiling diesel v1.4.6 (/build/source/diesel)
+    # error: this `#[deprecated]` annotation has no effect
+    #    --> diesel/src/query_builder/insert_statement/mod.rs:205:1
+    #     |
+    # 205 | / #[deprecated(
+    # 206 | |     since = "1.2.0",
+    # 207 | |     note = "Use `<&'a [U] as Insertable<T>>::Values` instead"
+    # 208 | | )]
+    #     | |__^ help: remove the unnecessary deprecation attribute
+    #     |
+    #     = note: `#[deny(useless_deprecated)]` on by default
+    ./fix-deprecated.patch
   ];
 
-  cargoBuildFlags = [ "--no-default-features --features \"${features}\"" ];
+  cargoBuildFlags = [ "--no-default-features" "--features" "${lib.concatStringsSep "," features}" ];
   cargoPatches = [ ./cargo-lock.patch ];
-  cargoSha256 = "1vbb7r0dpmq8363i040bkhf279pz51c59kcq9v5qr34hs49ish8g";
+  cargoSha256 = "1vkwp861vm20agj0lkhnnxgg4vwg4d5clvvyzxrmm4y4yw46cdl2";
 
   nativeBuildInputs = [ pkg-config ];
+
   buildInputs = [ openssl ]
     ++ optional stdenv.isDarwin Security
     ++ optional (stdenv.isDarwin && mysqlSupport) libiconv
     ++ optional sqliteSupport sqlite
     ++ optional postgresqlSupport postgresql
-    ++ optionals mysqlSupport [ mysql zlib ];
+    ++ optionals mysqlSupport [ mariadb zlib ];
 
-  # We must `cd diesel_cli`, we cannot use `--package diesel_cli` to build
-  # because --features fails to apply to the package:
-  # https://github.com/rust-lang/cargo/issues/5015
-  # https://github.com/rust-lang/cargo/issues/4753
-  preBuild = "cd diesel_cli";
-  postBuild = "cd ..";
+  buildAndTestSubdir = "diesel_cli";
 
   checkPhase = optionalString sqliteSupport ''
     (cd diesel_cli && cargo check --features sqlite)
@@ -65,7 +70,7 @@ rustPlatform.buildRustPackage rec {
 
   # Fix the build with mariadb, which otherwise shows "error adding symbols:
   # DSO missing from command line" errors for libz and libssl.
-  NIX_LDFLAGS = lib.optionalString mysqlSupport "-lz -lssl -lcrypto";
+  NIX_LDFLAGS = optionalString mysqlSupport "-lz -lssl -lcrypto";
 
   meta = with lib; {
     description = "Database tool for working with Rust projects that use Diesel";