about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2022-05-12 21:33:02 +0200
committerzowoq <59103226+zowoq@users.noreply.github.com>2022-05-13 08:18:39 +1000
commit357da6c29693d0909e0852297ae0edc74d9399ab (patch)
tree70a091949f75ddde0e9f4a75bd183c81317174d8 /pkgs/build-support
parent39936c75c581828a7cebad2e274cc8db08007f58 (diff)
buildRustPackage: make cargoDeps logic easier to follow
The old logic flow had the structure

  if ( … ) {
    if ( … ) {
      …
    } else {
      …
    }
  } else {
    …
  }

which is quite hard to follow in Nix. Instead we ensure that no if
expression is inside a then branch.

This change is zero rebuild, as no logic was changed.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/rust/build-rust-package/default.nix7
1 files changed, 3 insertions, 4 deletions
diff --git a/pkgs/build-support/rust/build-rust-package/default.nix b/pkgs/build-support/rust/build-rust-package/default.nix
index 2cfd8d172869e..e4772592e46cf 100644
--- a/pkgs/build-support/rust/build-rust-package/default.nix
+++ b/pkgs/build-support/rust/build-rust-package/default.nix
@@ -59,8 +59,8 @@ assert buildType == "release" || buildType == "debug";
 let
 
   cargoDeps =
-    if cargoVendorDir == null
-    then if cargoLock != null then importCargoLock cargoLock
+    if cargoVendorDir != null then null
+    else if cargoLock != null then importCargoLock cargoLock
     else fetchCargoTarball ({
       inherit src srcs sourceRoot unpackPhase cargoUpdateHook;
       name = cargoDepsName;
@@ -69,8 +69,7 @@ let
       hash = args.cargoHash;
     } // lib.optionalAttrs (args ? cargoSha256) {
       sha256 = args.cargoSha256;
-    } // depsExtraArgs)
-    else null;
+    } // depsExtraArgs);
 
   # If we have a cargoSha256 fixed-output derivation, validate it at build time
   # against the src fixed-output derivation to check consistency.