Closed mitchmindtree closed 3 years ago
I have lot of deps with pkg-config, and they build fine, but you need to do something like this:
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
let
c = import ./Cargo.nix {
inherit pkgs;
defaultCrateOverrides = pkgs.defaultCrateOverrides // {
rust_x11 = attrs: {
buildInputs = [ pkg-config someOtherMissingDep ];
};
};
};
in c.workspaceMembers."nannou".build
Thanks, I clearly didn't read the README thoroughly enough! For future readers, there's a section on this here.
Hey, thanks for all your work on such a cool tool!
I'm frequently creating new projects that have quite large dependencies, and often the initial build can take a good 15+ minutes. I'm excited to see how well crate2nix can help with taking advantage of the nix store as a cache for crate build artifacts.
I've tried running it on a few projects with varying success. Some simpler projects work nicely, but I'm having issues with more sophisticated builds (e.g. for GUI applications). Most often these errors seem to have some relation to
pkg-config
not being able find some library when invoked in a build.rs script, or something along these lines.Here's an example attempting at building nannou:
Generated
Cargo.nix
Cargo.nix.txt
(added
.txt
so that github would allow upload)Command
Output
I can confirm that I can build the project successfully using the regular
cargo build
command. I'm calling the command inside arust-dev-env.nix
shell environment that should provide all the necessary dependencies asbuildInputs
(e.g. x11, pkg-config, etc). Perhaps the issue is that thesebuildInputs
are not forwarded to thenix-build
command above? Do I have to add those manually to the generatedCargo.nix
somehow?Any advice appreciated :)