error: failed to run custom build command for `lindera-unidic v0.43.3`
Caused by:
process didn't exit successfully: `/build/source/target/release/build/lindera-unidic-3aeb8cd85c800f36/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-changed=build.rs
cargo:rerun-if-changed=Cargo.toml
cargo::rustc-env=LINDERA_WORKDIR=/build/source/target/aarch64-unknown-linux-gnu/release/build/lindera-unidic-cd9022d10fc41819/out
--- stderr
Error: "Failed to download a valid file from all sources"
Looking at the source of the lindera-unidic crate, it appears that it needs network access during build, but Nix doesn’t allow that. How do I solve this?
In general, you cannot “solve” this; nix prevents downloads during builds precisely to show you broken software that relies on downloads at build-time, since those sources cannot be adequately tracked, making them very difficult to build reproducibly (you’d need to set up some kind of proxy that presents cached sources and probably MITM https connections).
My personal preference is to just not use software that requires external dependencies like this at build time, but I don’t know how well-standardized this particular type of external dependency is.
Another noob question: How do I make nix execute the commands mentioned in the solution? I. e. how do I append something to a phase (e. g. configPhase, buildPhase) and which phase would be suitable for this?
As far as I can tell, you wouldn’t use any extra commands in any phases, but instead add a LINDERA_CACHE attribute (env.LINDERA_CACHE if you are using structured attrs) which you set to a fetchTarball call that pulls the tarball and extracts it.
Not quite, given the commands there it wants the raw, non-extracted tarball. It also wants it in a specific subdirectory, so you’re going to have to do some symlinkJoin shenanigans. Even then, YMMV, it’s quite possible it wants read-write access or other minor annoyances. It’ll take a bit of fiddling.
It’s possible it’s easier to just bind a fetchTarball to a variable in a let and then put it in the correct place with mkdir and cp in a preFixup or something.
This might be harder still. You can normally use patchPhase to edit your source before the build, but the rust tooling creates a separate derivation for your input crates. It’d anyway not work because of Cargo.lock.
At that point you’ll have to read the docs for buildRustPackage and provide your own cargolock - this isn’t a trivial package