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 {
403
403
else parsed . urlFragment ;
404
404
} ;
405
405
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 ) ;
410
409
411
410
getCrateNameFromPath = path :
412
411
let
413
- cargoTomlCrate = builtins . fromTOML ( builtins . readFile " ${ src } / ${ path } /Cargo.toml" ) ;
412
+ cargoTomlCrate = builtins . fromTOML ( builtins . readFile path ) ;
414
413
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 ;
427
425
in
428
426
pkgs . runCommand ( lib . removeSuffix ".tar.gz" src . name ) { }
429
427
''
430
428
mkdir -p $out
431
- cp -apR ${ src } / ${ pathToExtract } /* $out
429
+ cp -apR ${ pathToExtract } /* $out
432
430
echo '{"package":null,"files":{}}' > $out/.cargo-checksum.json
433
431
'' ;
434
432
You can’t perform that action at this time.
0 commit comments