buildRustCrate: deduplicate dependency override code

The previous lines were only different in the kind of dependencies but
otherwise exactly the same. It makes the entire thing a bit more
readable by moving this into a function that takes care of this.
This commit is contained in:
Andreas Rammhold 2019-12-12 00:13:19 +01:00
parent 6ad22f5b4d
commit 3f49d7a3ea
No known key found for this signature in database
GPG key ID: E432E410B5E48C86

View file

@ -81,15 +81,8 @@ stdenv.mkDerivation (rec {
name = "rust_${crate.crateName}-${crate.version}";
depsBuildBuild = [ rust stdenv.cc ];
buildInputs = (crate.buildInputs or []) ++ buildInputs_;
dependencies =
map
(dep: lib.getLib (dep.override { rust = rust; release = release; verbose = verbose; crateOverrides = crateOverrides; }))
dependencies_;
buildDependencies =
map
(dep: lib.getLib (dep.override { rust = rust; release = release; verbose = verbose; crateOverrides = crateOverrides; }))
buildDependencies_;
dependencies = makeDependencies dependencies_;
buildDependencies = makeDependencies buildDependencies_;
completeDeps = lib.unique (dependencies ++ lib.concatMap (dep: dep.completeDeps) dependencies);
completeBuildDeps = lib.unique (