forked from mirrors/nixpkgs
Merge pull request #67865 from ivan/init-diesel-cli
diesel-cli: init at 1.4.0
This commit is contained in:
commit
29e7629318
88
pkgs/development/tools/diesel-cli/allow-warnings.patch
Normal file
88
pkgs/development/tools/diesel-cli/allow-warnings.patch
Normal file
|
@ -0,0 +1,88 @@
|
|||
diff --git a/diesel/src/lib.rs b/diesel/src/lib.rs
|
||||
index 4e743eb4..97c53ed8 100644
|
||||
--- a/diesel/src/lib.rs
|
||||
+++ b/diesel/src/lib.rs
|
||||
@@ -131,7 +131,6 @@
|
||||
#![cfg_attr(feature = "unstable", feature(specialization, try_from))]
|
||||
// Built-in Lints
|
||||
#![deny(
|
||||
- warnings,
|
||||
missing_debug_implementations,
|
||||
missing_copy_implementations,
|
||||
missing_docs
|
||||
diff --git a/diesel_cli/src/main.rs b/diesel_cli/src/main.rs
|
||||
index 741ca003..cf93bb8f 100644
|
||||
--- a/diesel_cli/src/main.rs
|
||||
+++ b/diesel_cli/src/main.rs
|
||||
@@ -1,5 +1,5 @@
|
||||
// Built-in Lints
|
||||
-#![deny(warnings, missing_copy_implementations)]
|
||||
+#![deny(missing_copy_implementations)]
|
||||
// Clippy lints
|
||||
#![allow(clippy::option_map_unwrap_or_else, clippy::option_map_unwrap_or)]
|
||||
#![warn(
|
||||
diff --git a/diesel_cli/tests/tests.rs b/diesel_cli/tests/tests.rs
|
||||
index 2edee846..c96917c4 100644
|
||||
--- a/diesel_cli/tests/tests.rs
|
||||
+++ b/diesel_cli/tests/tests.rs
|
||||
@@ -1,5 +1,3 @@
|
||||
-#![deny(warnings)]
|
||||
-
|
||||
extern crate chrono;
|
||||
extern crate diesel;
|
||||
#[macro_use]
|
||||
diff --git a/diesel_derives/src/lib.rs b/diesel_derives/src/lib.rs
|
||||
index 2c43b2a3..44dcf3f9 100644
|
||||
--- a/diesel_derives/src/lib.rs
|
||||
+++ b/diesel_derives/src/lib.rs
|
||||
@@ -1,6 +1,6 @@
|
||||
#![recursion_limit = "1024"]
|
||||
// Built-in Lints
|
||||
-#![deny(warnings, missing_copy_implementations)]
|
||||
+#![deny(missing_copy_implementations)]
|
||||
// Clippy lints
|
||||
#![allow(
|
||||
clippy::needless_pass_by_value,
|
||||
diff --git a/diesel_derives/tests/tests.rs b/diesel_derives/tests/tests.rs
|
||||
index 636fea66..f86f3dcc 100644
|
||||
--- a/diesel_derives/tests/tests.rs
|
||||
+++ b/diesel_derives/tests/tests.rs
|
||||
@@ -1,5 +1,3 @@
|
||||
-#![deny(warnings)]
|
||||
-
|
||||
#[macro_use]
|
||||
extern crate cfg_if;
|
||||
#[macro_use]
|
||||
diff --git a/diesel_migrations/migrations_internals/src/lib.rs b/diesel_migrations/migrations_internals/src/lib.rs
|
||||
index 933e21a8..7c4d0222 100644
|
||||
--- a/diesel_migrations/migrations_internals/src/lib.rs
|
||||
+++ b/diesel_migrations/migrations_internals/src/lib.rs
|
||||
@@ -1,5 +1,5 @@
|
||||
// Built-in Lints
|
||||
-#![deny(warnings, missing_debug_implementations, missing_copy_implementations)]
|
||||
+#![deny(missing_debug_implementations, missing_copy_implementations)]
|
||||
// Clippy lints
|
||||
#![allow(
|
||||
clippy::option_map_unwrap_or_else,
|
||||
diff --git a/diesel_migrations/migrations_macros/src/lib.rs b/diesel_migrations/migrations_macros/src/lib.rs
|
||||
index 0a83234e..2f509c04 100644
|
||||
--- a/diesel_migrations/migrations_macros/src/lib.rs
|
||||
+++ b/diesel_migrations/migrations_macros/src/lib.rs
|
||||
@@ -1,5 +1,5 @@
|
||||
// Built-in Lints
|
||||
-#![deny(warnings, missing_debug_implementations, missing_copy_implementations)]
|
||||
+#![deny(missing_debug_implementations, missing_copy_implementations)]
|
||||
// Clippy lints
|
||||
#![allow(
|
||||
clippy::option_map_unwrap_or_else,
|
||||
diff --git a/diesel_migrations/src/lib.rs b/diesel_migrations/src/lib.rs
|
||||
index c85414e5..f025f237 100644
|
||||
--- a/diesel_migrations/src/lib.rs
|
||||
+++ b/diesel_migrations/src/lib.rs
|
||||
@@ -1,5 +1,5 @@
|
||||
// Built-in Lints
|
||||
-#![deny(warnings, missing_copy_implementations)]
|
||||
+#![deny(missing_copy_implementations)]
|
||||
// Clippy lints
|
||||
#![allow(
|
||||
clippy::needless_pass_by_value,
|
1589
pkgs/development/tools/diesel-cli/cargo-lock.patch
Normal file
1589
pkgs/development/tools/diesel-cli/cargo-lock.patch
Normal file
File diff suppressed because it is too large
Load diff
77
pkgs/development/tools/diesel-cli/default.nix
Normal file
77
pkgs/development/tools/diesel-cli/default.nix
Normal file
|
@ -0,0 +1,77 @@
|
|||
{ stdenv, lib, rustPlatform, fetchFromGitHub, openssl, pkgconfig, Security
|
||||
, sqliteSupport ? true, sqlite
|
||||
, postgresqlSupport ? true, postgresql
|
||||
, mysqlSupport ? true, mysql, zlib, libiconv
|
||||
}:
|
||||
|
||||
assert lib.assertMsg (sqliteSupport == true || postgresqlSupport == true || mysqlSupport == true)
|
||||
"support for at least one database must be enabled";
|
||||
|
||||
let
|
||||
inherit (stdenv.lib) optional optionals optionalString;
|
||||
features = ''
|
||||
${optionalString sqliteSupport "sqlite"} \
|
||||
${optionalString postgresqlSupport "postgres"} \
|
||||
${optionalString mysqlSupport "mysql"} \
|
||||
'';
|
||||
in
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "diesel-cli";
|
||||
version = "1.4.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "diesel-rs";
|
||||
repo = "diesel";
|
||||
rev = "v${version}";
|
||||
sha256 = "0wp4hvpl9cf8hw1jyz3z476k5blrh6srfpv36dw10bj126rz9pvb";
|
||||
};
|
||||
|
||||
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
|
||||
];
|
||||
|
||||
cargoBuildFlags = [ "--no-default-features --features \"${features}\"" ];
|
||||
cargoPatches = [ ./cargo-lock.patch ];
|
||||
cargoSha256 = "0xlcskddhy7xsiwj54gmn1xlgkfxb4dwrys7rbamfz1h8aa6ixjx";
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
buildInputs = [ openssl ]
|
||||
++ optional stdenv.isDarwin Security
|
||||
++ optional (stdenv.isDarwin && mysqlSupport) libiconv
|
||||
++ optional sqliteSupport sqlite
|
||||
++ optional postgresqlSupport postgresql
|
||||
++ optionals mysqlSupport [ mysql 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 ..";
|
||||
|
||||
checkPhase = optionalString sqliteSupport ''
|
||||
(cd diesel_cli && cargo check --features sqlite)
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
$out/bin/diesel --version
|
||||
'';
|
||||
|
||||
# Fix the build with mariadb, which otherwise shows "error adding symbols:
|
||||
# DSO missing from command line" errors for libz and libssl.
|
||||
NIX_LDFLAGS = lib.optional mysqlSupport "-lz -lssl -lcrypto";
|
||||
|
||||
meta = with lib; {
|
||||
description = "Database tool for working with Rust projects that use Diesel";
|
||||
homepage = https://github.com/diesel-rs/diesel/tree/master/diesel_cli;
|
||||
license = with licenses; [ mit asl20 ];
|
||||
platforms = platforms.all;
|
||||
maintainers = with maintainers; [ ivan ];
|
||||
};
|
||||
}
|
19
pkgs/development/tools/diesel-cli/update-cargo-lock.sh
Executable file
19
pkgs/development/tools/diesel-cli/update-cargo-lock.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This updates cargo-lock.patch for the diesel version listed in default.nix.
|
||||
|
||||
set -eu -o verbose
|
||||
|
||||
here=$PWD
|
||||
version=$(cat default.nix | grep '^ version = "' | cut -d '"' -f 2)
|
||||
checkout=$(mktemp -d)
|
||||
git clone -b "v$version" --depth=1 https://github.com/diesel-rs/diesel "$checkout"
|
||||
cd "$checkout"
|
||||
|
||||
rm -f rust-toolchain
|
||||
cargo generate-lockfile
|
||||
git add -f Cargo.lock
|
||||
git diff HEAD -- Cargo.lock > "$here"/cargo-lock.patch
|
||||
|
||||
cd "$here"
|
||||
rm -rf "$checkout"
|
|
@ -1483,6 +1483,10 @@ in
|
|||
|
||||
dibbler = callPackage ../tools/networking/dibbler { };
|
||||
|
||||
diesel-cli = callPackage ../development/tools/diesel-cli {
|
||||
inherit (darwin.apple_sdk.frameworks) Security;
|
||||
};
|
||||
|
||||
ding = callPackage ../applications/misc/ding {
|
||||
aspellDicts_de = aspellDicts.de;
|
||||
aspellDicts_en = aspellDicts.en;
|
||||
|
|
Loading…
Reference in a new issue