crate2nix icon indicating copy to clipboard operation
crate2nix copied to clipboard

sqlx depends on CARGO environment variable

Open nyarly opened this issue 4 weeks ago • 1 comments

I'm unsure whether there's a sensible way to fix this, but sqlx macros use $CARGO to call cargo metadata.

I'm considering pulling in cargo and then overriding in an environment variable? That seems kind of ridiculous though.

nyarly avatar Nov 12 '25 23:11 nyarly

I've worked around this for now with:

            wag-the-pig = cargoNix.rootCrate.build.overrideAttrs (previousAttrs: {
              buildPhase = ''
                export CARGO=${pkgs.cargo}/bin/cargo

              ''
              + previousAttrs.buildPhase;
            })

Maybe sqlx should accept a CARGO_METADATA environment variable, but it would need to be provided by crate2nix or buildRustCrate

nyarly avatar Nov 13 '25 17:11 nyarly