Skip to content

Can't build Zola because of a relative path import #666

Answered by ipetkov
bemyak asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @bemyak! Typically crates should not attempt to read any files outside of crate's own "root" directory (i.e. where Cargo.toml file is stored). Git dependencies happen to work (outside of Nix/crane) because of how cargo checks out the repo, but generally the same code would be broken if the code was ever published to a registry like crates.io.

You have two (well, three) options to resolve the issue:

  1. Use your own fork which changes where the files are stored/included
  2. Submit a fix upstream and wait for the project to accept it
  3. Write some extra Nix code to patch the crate's sources during vendoring: https://crane.dev/patching_dependency_sources.html

Hope this helps!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bemyak
Comment options

Answer selected by ipetkov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants