mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-23 08:22:41 +03:00
a1e56fba69
It's a builtin that we can just use directly.
19 lines
505 B
Nix
19 lines
505 B
Nix
{}:
|
|
|
|
args:
|
|
let
|
|
src = args.src or (throw ''
|
|
unable to infer crate name and version. Please make sure the src directory
|
|
contains a valid Cargo.toml file, or consider setting a derivation name explicitly
|
|
'');
|
|
|
|
cargoToml = args.cargoToml or (args.src + "/Cargo.toml");
|
|
cargoTomlContents = args.cargoTomlContents or (builtins.readFile cargoToml);
|
|
|
|
toml = builtins.fromTOML cargoTomlContents;
|
|
in
|
|
{
|
|
pname = toml.package.name or "cargo-package";
|
|
version = toml.package.version or "0.0.1";
|
|
}
|