File tree Expand file tree Collapse file tree 1 file changed +16
-18
lines changed Expand file tree Collapse file tree 1 file changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -403,32 +403,30 @@ rec {
403403 else parsed . urlFragment ;
404404 } ;
405405
406- rootCargo = builtins . fromTOML ( builtins . readFile "${ src } /Cargo.toml" ) ;
407- isWorkspace = rootCargo ? "workspace" ;
408- isPackage = rootCargo ? "package" ;
409- containedCrates = rootCargo . workspace . members ++ ( if isPackage then [ "." ] else [ ] ) ;
406+ allCargoTomls = lib . filter
407+ ( lib . hasSuffix "Cargo.toml" )
408+ ( lib . filesystem . listFilesRecursive src ) ;
410409
411410 getCrateNameFromPath = path :
412411 let
413- cargoTomlCrate = builtins . fromTOML ( builtins . readFile " ${ src } / ${ path } /Cargo.toml" ) ;
412+ cargoTomlCrate = builtins . fromTOML ( builtins . readFile path ) ;
414413 in
415- cargoTomlCrate . package . name ;
416-
417- pathToExtract =
418- if isWorkspace then
419- builtins . head
420- ( builtins . filter
421- ( to_filter :
422- ( getCrateNameFromPath to_filter ) == name
423- )
424- containedCrates )
425- else
426- "." ;
414+ cargoTomlCrate . package . name or null ;
415+
416+ packageCargoToml =
417+ builtins . head
418+ ( builtins . filter
419+ ( to_filter :
420+ ( getCrateNameFromPath to_filter ) == name
421+ )
422+ allCargoTomls ) ;
423+
424+ pathToExtract = lib . removeSuffix "Cargo.toml" packageCargoToml ;
427425 in
428426 pkgs . runCommand ( lib . removeSuffix ".tar.gz" src . name ) { }
429427 ''
430428 mkdir -p $out
431- cp -apR ${ src } / ${ pathToExtract } /* $out
429+ cp -apR ${ pathToExtract } /* $out
432430 echo '{"package":null,"files":{}}' > $out/.cargo-checksum.json
433431 '' ;
434432
You can’t perform that action at this time.
0 commit comments