Preferred way to bundle data with `cargo install`

I have a web app (axum) that users some web assets (style.css, some svg icons, etc). Not a lot of it, so it sits in the repo side by side the code.

At runtime my app expects these files to be around. For distro's package managers it comes down to cp -r these files in the right place (think /usr/share/myapp/).

But when someone wants to try my app using cargo install... I don't see any way to somehow copy these assets as well. I can implement all sorts of things, but would like to avoid include_bytes! everything if possible.

What do people do in this situation?

Essentially, it's either include_bytes! or not doing cargo install, unfortunately. Cargo doesn't allow for any post-build hooks, and on installation it simply copies the binary. If the workflow for specific app needs something else, it's expected that some other build system does the orchestration, and Cargo just provides the binary.

cargo install doesn't know how to do anything other than cargo build your crate and then copy the binary into $CARGO_HOME/bin.

With cargo install you have to embed the files into the binary or fetch them at runtime from the internet.

But even after you find the assets, you still have to put them somewhere. If you recommend cargo install, then cargo uninstall should work with your program for courtesy's sake. It only deletes the binary from $CARGO_HOME/bin and can't remove anything else like files you placed into /usr/share/foo/.

You need a packaging system more sophisticated than cargo [un]install, which can be anywhere from "extract this zip file/tarball", "curl <URL> | sh", or using cargo-deb to build a .deb package. You might also want to look at cargo-bundle.