mirror of
https://github.com/ipetkov/crane.git
synced 2024-11-22 23:17:15 +03:00
a3f0c63eed
We don't need to nest `cleanCargoSource` and `path` just to populate a default value for `name`. As they both ultimately delegate to `builtins.path`, the nesting can lead to IFD in situations which are otherwise avoidable
15 lines
316 B
Nix
15 lines
316 B
Nix
{ internalCrateNameForCleanSource
|
|
, lib
|
|
}:
|
|
|
|
input:
|
|
let
|
|
inputIsAttrs = lib.isAttrs input;
|
|
name = input.name or (internalCrateNameForCleanSource (
|
|
if inputIsAttrs then input.path else input
|
|
));
|
|
|
|
pathArgs = if inputIsAttrs then input else { path = input; };
|
|
in
|
|
builtins.path ({ inherit name; } // pathArgs)
|