summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2019-12-18 00:51:26 +0100
committerAndreas Rammhold <andreas@rammhold.de>2020-01-07 11:57:34 +0100
commit3e61906e1cc80f0b700128cb74295e072bc94242 (patch)
tree27658003eb0e996d17570a36062d1e4f0db2e2c6 /pkgs
parenta3a51763f918d53278db8d16d87f7adbca77e105 (diff)
downloadnixpkgs-3e61906e1cc80f0b700128cb74295e072bc94242.tar
nixpkgs-3e61906e1cc80f0b700128cb74295e072bc94242.tar.gz
nixpkgs-3e61906e1cc80f0b700128cb74295e072bc94242.tar.bz2
nixpkgs-3e61906e1cc80f0b700128cb74295e072bc94242.tar.lz
nixpkgs-3e61906e1cc80f0b700128cb74295e072bc94242.tar.xz
nixpkgs-3e61906e1cc80f0b700128cb74295e072bc94242.tar.zst
nixpkgs-3e61906e1cc80f0b700128cb74295e072bc94242.zip
buildRustCrate: slight "rewording" and reformatting
There is no point in reinventinb builtins through `filterAttrs` or the
like. Lets just stick to what we already have in our toolbelt.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/build-support/rust/build-rust-crate/default.nix28
1 files changed, 19 insertions, 9 deletions
diff --git a/pkgs/build-support/rust/build-rust-crate/default.nix b/pkgs/build-support/rust/build-rust-crate/default.nix
index fb95c435380..2885b2aef51 100644
--- a/pkgs/build-support/rust/build-rust-crate/default.nix
+++ b/pkgs/build-support/rust/build-rust-crate/default.nix
@@ -55,8 +55,9 @@ let crate = crate_ // (lib.attrByPath [ crate_.crateName ] (attr: {}) crateOverr
       "src" "buildInputs" "crateBin" "crateLib" "libName" "libPath"
       "buildDependencies" "dependencies" "features" "crateRenames"
       "crateName" "version" "build" "authors" "colors" "edition"
+      "buildTests"
     ];
-    extraDerivationAttrs = lib.filterAttrs (n: v: ! lib.elem n processedAttrs) crate;
+    extraDerivationAttrs = builtins.removeAttrs crate processedAttrs;
     buildInputs_ = buildInputs;
     extraRustcOpts_ = extraRustcOpts;
     buildTests_ = buildTests;
@@ -73,13 +74,23 @@ in
 stdenv.mkDerivation (rec {
 
     inherit (crate) crateName;
-    inherit preUnpack postUnpack prePatch patches postPatch preConfigure postConfigure preBuild postBuild preInstall postInstall;
-
-    src = if lib.hasAttr "src" crate then
-        crate.src
-      else
-        fetchCrate { inherit (crate) crateName version sha256; };
-    name = "rust_${crate.crateName}-${crate.version}${lib.optionalString buildTests "-test"}";
+    inherit
+      preUnpack
+      postUnpack
+      prePatch
+      patches
+      postPatch
+      preConfigure
+      postConfigure
+      preBuild
+      postBuild
+      preInstall
+      postInstall
+      buildTests
+    ;
+
+    src = crate.src or (fetchCrate { inherit (crate) crateName version sha256; });
+    name = "rust_${crate.crateName}-${crate.version}${lib.optionalString buildTests_ "-test"}";
     depsBuildBuild = [ rust stdenv.cc ];
     buildInputs = (crate.buildInputs or []) ++ buildInputs_;
     dependencies = makeDependencies dependencies_;
@@ -123,7 +134,6 @@ stdenv.mkDerivation (rec {
       ++ extraRustcOpts_
       ++ (lib.optional (edition != null) "--edition ${edition}");
 
-    buildTests = buildTests_;
 
     configurePhase = configureCrate {
       inherit crateName buildDependencies completeDeps completeBuildDeps crateDescription