about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorFaye Duxovni <duxovni@duxovni.org>2022-04-15 20:13:47 -0400
committerYt <raphael@megzari.com>2022-04-16 06:53:45 -0400
commitbc5e8ae506d1d25cd62560e6bc626cf334f7336f (patch)
tree46ced1c44f198a81e97d75908e4fb1de21bb3d18 /pkgs
parent4624d0a8d30b6f5c67347114b05bd95baed7e2dc (diff)
buildRustCrate: don't try to set CARGO_FEATURE_ variables for dep: features
These features are internal-only, have special characters that bash
doesn't support in variable names, and aren't normally given
environment variables by cargo as far as I can tell.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/build-support/rust/build-rust-crate/default.nix9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkgs/build-support/rust/build-rust-crate/default.nix b/pkgs/build-support/rust/build-rust-crate/default.nix
index afb938e511828..20b93b1921f84 100644
--- a/pkgs/build-support/rust/build-rust-crate/default.nix
+++ b/pkgs/build-support/rust/build-rust-crate/default.nix
@@ -277,9 +277,14 @@ crate_: lib.makeOverridable
 
       # Create a list of features that are enabled by the crate itself and
       # through the features argument of buildRustCrate. Exclude features
-      # with a forward slash, since they are passed through to dependencies.
+      # with a forward slash, since they are passed through to dependencies,
+      # and dep: features, since they're internal-only and do nothing except
+      # enable optional dependencies.
       crateFeatures = lib.optionals (crate ? features)
-        (builtins.filter (f: !lib.hasInfix "/" f) (crate.features ++ features));
+        (builtins.filter
+          (f: !(lib.hasInfix "/" f || lib.hasPrefix "dep:" f))
+          (crate.features ++ features)
+        );
 
       libName = if crate ? libName then crate.libName else crate.crateName;
       libPath = if crate ? libPath then crate.libPath else "";