enable all-features in nix for CI builds
CI is running `cargo build --all-features`, so we should be passing all the features to nix as well. The only thing this currently affects is the jemalloc_prof feature, but if we add any non-default features that affect nix in the future they should also be handled correctly now.
This commit is contained in:
parent
0fd0a5d73c
commit
c0f8253fc5
5 changed files with 23 additions and 5 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
# Options (keep sorted)
|
||||
, default_features ? true
|
||||
, all_features ? false
|
||||
, features ? []
|
||||
, profile ? "release"
|
||||
}:
|
||||
|
@ -20,13 +21,23 @@ let
|
|||
# on the nix side depend on feature values.
|
||||
workspaceMembers = builtins.map (member: "${inputs.self}/src/${member}")
|
||||
(builtins.attrNames (builtins.readDir "${inputs.self}/src"));
|
||||
crateFeatures = path:
|
||||
let manifest = lib.importTOML "${path}/Cargo.toml"; in
|
||||
lib.remove "default" (lib.attrNames manifest.features) ++
|
||||
lib.attrNames
|
||||
(lib.filterAttrs
|
||||
(_: dependency: dependency.optional or false)
|
||||
manifest.dependencies);
|
||||
crateDefaultFeatures = path:
|
||||
(lib.importTOML "${path}/Cargo.toml").features.default;
|
||||
allDefaultFeatures = lib.unique
|
||||
(lib.flatten (builtins.map crateDefaultFeatures workspaceMembers));
|
||||
allFeatures = lib.unique
|
||||
(lib.flatten (builtins.map crateFeatures workspaceMembers));
|
||||
features' = lib.unique
|
||||
(features ++
|
||||
lib.optionals default_features allDefaultFeatures);
|
||||
lib.optionals default_features allDefaultFeatures ++
|
||||
lib.optionals all_features allFeatures);
|
||||
|
||||
featureEnabled = feature : builtins.elem feature features';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue