1
0
Fork 0
forked from mirror/grapevine

add all-features devshell

Because the nix rocksdb build depends on the jemalloc feature, you need
to use a different devshell when passing --all-features to cargo than
the default.
This commit is contained in:
Benjamin Lee 2024-05-30 00:44:30 -07:00
parent 8f24ac1f27
commit fa48c48d52
No known key found for this signature in database
GPG key ID: FB9624E2885D55A4
2 changed files with 19 additions and 3 deletions

View file

@ -23,6 +23,11 @@
oci-image = self.callPackage ./nix/pkgs/oci-image {};
# Return a new scope with overrides applied to the 'default' package
overrideDefaultPackage = args: self.overrideScope (final: prev: {
default = prev.default.override args;
});
shell = self.callPackage ./nix/shell.nix {};
# The Rust toolchain to use
@ -84,6 +89,9 @@
);
devShells.default = (mkScope pkgs).shell;
devShells.all-features = ((mkScope pkgs).overrideDefaultPackage {
all-features = true;
}).shell;
}
)
//

View file

@ -11,6 +11,7 @@
# Options (keep sorted)
, default-features ? true
, all-features ? false
, features ? []
, profile ? "release"
}:
@ -18,10 +19,17 @@
let
# We perform default-feature unification in nix, because some of the dependencies
# on the nix side depend on feature values.
allDefaultFeatures =
(lib.importTOML "${inputs.self}/Cargo.toml").features.default;
cargoManifest = lib.importTOML "${inputs.self}/Cargo.toml";
allDefaultFeatures = cargoManifest.features.default;
allFeatures = lib.unique (
lib.remove "default" (lib.attrNames cargoManifest.features) ++
lib.attrNames
(lib.filterAttrs (_: dependency: dependency.optional or false)
cargoManifest.dependencies));
features' = lib.unique
(features ++ lib.optionals default-features allDefaultFeatures);
(features ++
lib.optionals default-features allDefaultFeatures ++
lib.optionals all-features allFeatures);
featureEnabled = feature : builtins.elem feature features';