nix: get all features from main crate

This commit is contained in:
strawberry 2024-06-02 21:08:52 +00:00 committed by Jason Volk
parent 887496d040
commit 95ca9d00a2

View file

@ -23,8 +23,6 @@
let let
# We perform default-feature unification in nix, because some of the dependencies # We perform default-feature unification in nix, because some of the dependencies
# on the nix side depend on feature values. # 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: crateFeatures = path:
let manifest = lib.importTOML "${path}/Cargo.toml"; in let manifest = lib.importTOML "${path}/Cargo.toml"; in
lib.remove "default" (lib.attrNames manifest.features) ++ lib.remove "default" (lib.attrNames manifest.features) ++
@ -34,10 +32,8 @@ crateFeatures = path:
manifest.dependencies); manifest.dependencies);
crateDefaultFeatures = path: crateDefaultFeatures = path:
(lib.importTOML "${path}/Cargo.toml").features.default; (lib.importTOML "${path}/Cargo.toml").features.default;
allDefaultFeatures = lib.unique allDefaultFeatures = crateDefaultFeatures "${inputs.self}/src/main";
(lib.flatten (builtins.map crateDefaultFeatures workspaceMembers)); allFeatures = crateFeatures "${inputs.self}/src/main";
allFeatures = lib.unique
(lib.flatten (builtins.map crateFeatures workspaceMembers));
features' = lib.unique features' = lib.unique
(features ++ (features ++
lib.optionals default_features allDefaultFeatures ++ lib.optionals default_features allDefaultFeatures ++