Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: generation of plantuml's diagrams in book #11

Merged
merged 1 commit into from
Jun 2, 2024

Conversation

AlexSherbinin
Copy link
Contributor

image
Noticed this error in Architecture section.
The reason was in PlantUML's binary location: mdbook-plantuml expects that it placed in /usr/bin directory while it placed in /nix

@igordejanovic igordejanovic merged commit ab634ad into igordejanovic:main Jun 2, 2024
6 checks passed
@igordejanovic
Copy link
Owner

good catch. thanks.

@igordejanovic
Copy link
Owner

@AlexSherbinin There is another issue I'm currently investigating. All #includes which reference files outside of docs folder are not replaced with the content. So, there is difference in running nix build -o book and nix develop + mdbook build. The former runs in chroot it seems which can be observed by changing buildPhase string (e.g. adding spaces just to invalidate hash, is there a way to force rebuild without this change?) and running nix build -L -o book.

This seems reasonable as tests/examples should also be treated as inputs to the build so rebuild should be triggered when something in these folder changes. I'm just not sure how to bring this to the inputs and allow for relative paths in include references to work as usual.

One way this might be fixed is moving flake.nix to the root of the project. Maybe even using flake to setup Rust, cargo and everything. But I'm still considering are there any downsides.

@AlexSherbinin
Copy link
Contributor Author

One way this might be fixed is moving flake.nix to the root of the project. Maybe even using flake to setup Rust, cargo and everything. But I'm still considering are there any downsides.

Good idea. I recommend to use crane for building with cargo and rust-overlay to setup toolchain.
But there is one downside: you cannot access the network while a buildPhase, because Nix's flakes are evaluated in a sandbox. Why is it a downside? For example I was trying to setup cargo-deny to check dependencies of my project for vulnerabilities and it wasn't working because it downloads RustSec DB while building(to fix it I was needed to use cargo-audit instead and download DB as a flake input). And there can be other tools that are using the network while buildPhase.

@AlexSherbinin
Copy link
Contributor Author

Also, if you don't want to wrap the entire project with Nix. There's a solution, but It's not really good: add tests/examples directories as flake's inputs(to do this there's a git+file:// path prefix) and every time when updating these directories you we'll needed to commit it and run nix flake update to update flake.lock

@igordejanovic
Copy link
Owner

Also, if you don't want to wrap the entire project with Nix. There's a solution, but It's not really good: add tests/examples directories as flake's inputs(to do this there's a git+file:// path prefix) and every time when updating these directories you we'll needed to commit it and run nix flake update to update flake.lock

Ah, thanks. Yeah, not very good solution but good to know. I guess that in #include I couldn't use relative paths as inputs would come from the Nix store, right? That would be another problem.

I moved flake file to root for now and did a basic Rust config through overlay. When I find some time I'll look into setting up full build/test/CI to use Nix.

@AlexSherbinin
Copy link
Contributor Author

I guess that in #include I couldn't use relative paths as inputs would come from the Nix store, right?

By default - couldn't. But you can create symlink in buildPhase script from example-flake-input.outPath to the root of your chroot environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants