mirror of
https://codeberg.org/icewind/mill-scale.git
synced 2026-06-03 09:54:19 +02:00
This commit is contained in:
parent
c71caa3c2b
commit
77800944c2
3 changed files with 34 additions and 23 deletions
17
cargo-meta.nix
Normal file
17
cargo-meta.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{ lib }:
|
||||
let
|
||||
inherit (builtins) isAttrs attrNames;
|
||||
inherit (lib) assertMsg remove;
|
||||
in
|
||||
cargoToml: rec {
|
||||
tomlPackage = cargoToml.package or cargoToml.workspace.package;
|
||||
hasMsrv = tomlPackage ? rust-version;
|
||||
hasWorkspace = tomlPackage ? workspace;
|
||||
hasFeatures = cargoToml ? features && isAttrs cargoToml.features;
|
||||
features = cargoToml.features or { };
|
||||
defaultFeatures = features.default or [ ];
|
||||
nonDefaultFeatures = remove "default" (attrNames features);
|
||||
hasNonDefaultFeatures = hasFeatures && (defaultFeatures != nonDefaultFeatures);
|
||||
hasDefaultFeatures = cargoToml ? features && cargoToml.features ? default;
|
||||
msrv = assert assertMsg hasMsrv ''"rust-version" not set in Cargo.toml''; tomlPackage.rust-version;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue