mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-27 02:52:02 +03:00
19 lines
504 B
Nix
19 lines
504 B
Nix
{ fromTOML }:
|
|
|
|
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 = fromTOML cargoTomlContents;
|
|
in
|
|
{
|
|
pname = toml.package.name or "cargo-package";
|
|
version = toml.package.version or "0.0.1";
|
|
}
|