about summary refs log tree commit diff
path: root/pkgs/build-support/rust/build-rust-crate/configure-crate.nix
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2019-12-11 21:53:42 +0100
committerAndreas Rammhold <andreas@rammhold.de>2019-12-11 22:01:36 +0100
commit0aac0e8d2c9c129bf1ed868bdc735b738b17b44e (patch)
tree302dd6320f1ab43ce606cd1f53a9a545cf1e0a05 /pkgs/build-support/rust/build-rust-crate/configure-crate.nix
parent1eda713fa4f842f9e5504e70fd59880040043dd1 (diff)
downloadnixlib-0aac0e8d2c9c129bf1ed868bdc735b738b17b44e.tar
nixlib-0aac0e8d2c9c129bf1ed868bdc735b738b17b44e.tar.gz
nixlib-0aac0e8d2c9c129bf1ed868bdc735b738b17b44e.tar.bz2
nixlib-0aac0e8d2c9c129bf1ed868bdc735b738b17b44e.tar.lz
nixlib-0aac0e8d2c9c129bf1ed868bdc735b738b17b44e.tar.xz
nixlib-0aac0e8d2c9c129bf1ed868bdc735b738b17b44e.tar.zst
nixlib-0aac0e8d2c9c129bf1ed868bdc735b738b17b44e.zip
buildRustCrate: builtins -> lib where possible
We can just use `lib` instead of `builtins` in all cases but the
`hashString` case. Also changed a few lines to make use of some optional
helpers from lib.
Diffstat (limited to 'pkgs/build-support/rust/build-rust-crate/configure-crate.nix')
-rw-r--r--pkgs/build-support/rust/build-rust-crate/configure-crate.nix10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix
index 2c7226b09622..fe0cc7d54e41 100644
--- a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix
+++ b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix
@@ -20,9 +20,9 @@
 , verbose
 , workspace_member }:
 let version_ = lib.splitString "-" crateVersion;
-    versionPre = if lib.tail version_ == [] then "" else builtins.elemAt version_ 1;
+    versionPre = if lib.tail version_ == [] then "" else lib.elemAt version_ 1;
     version = lib.splitVersion (lib.head version_);
-    rustcOpts = lib.lists.foldl' (opts: opt: opts + " " + opt)
+    rustcOpts = lib.foldl' (opts: opt: opts + " " + opt)
         (if release then "-C opt-level=3" else "-C debuginfo=2")
         (["-C codegen-units=$NIX_BUILD_CORES"] ++ extraRustcOpts);
     buildDeps = makeDeps buildDependencies crateRenames;
@@ -90,9 +90,9 @@ in ''
   export HOST="${stdenv.hostPlatform.config}"
   export PROFILE=${if release then "release" else "debug"}
   export OUT_DIR=$(pwd)/target/build/${crateName}.out
-  export CARGO_PKG_VERSION_MAJOR=${builtins.elemAt version 0}
-  export CARGO_PKG_VERSION_MINOR=${builtins.elemAt version 1}
-  export CARGO_PKG_VERSION_PATCH=${builtins.elemAt version 2}
+  export CARGO_PKG_VERSION_MAJOR=${lib.elemAt version 0}
+  export CARGO_PKG_VERSION_MINOR=${lib.elemAt version 1}
+  export CARGO_PKG_VERSION_PATCH=${lib.elemAt version 2}
   export CARGO_PKG_VERSION_PRE="${versionPre}"
   export CARGO_PKG_HOMEPAGE="${crateHomepage}"
   export NUM_JOBS=1