Giter Club home page Giter Club logo

Comments (4)

andir avatar andir commented on July 19, 2024

Try setting PROTOC="${protobuf}/bin/protoc"; in your actual crates override. e.g:

with (import <nixpkgs> {});

let
  myCrateBase = callPackage ./Cargo.nix {};
  myCrate = myCrateBase.rootCrate.build.override {
    crateOverrides = defaultCrateOverrides // {
      myCrate = attrs: {
        PROTOC="${protobuf}/bin/protoc";
      };
    };
  };
in
myCrate

I have a few cases where prost-build is being used to build the protobuf files and setting PROTOC works there.

from crate2nix.

bbigras avatar bbigras commented on July 19, 2024

It didn't seem to work.

One weird thing is that I also tried to set PROTOC = "${protobuf324}/bin/protoc"; and it didn't whine except for the same error I had before. Is it being evaluated?

I created a repo if you want to test https://github.com/bbigras/test-proto

from crate2nix.

danieldk avatar danieldk commented on July 19, 2024

Try setting PROTOC="${protobuf}/bin/protoc"; in your actual crates override. e.g:

I don't think that currently works. As far as I can see, crateOverrides are actually never passed through to buildRustCrate. However, if you modify the generated Cargo.nix with:

--- Cargo.nix.orig	2020-01-24 09:06:08.164919469 +0100
+++ Cargo.nix	2020-01-24 09:25:19.662569038 +0100
@@ -1293,7 +1293,8 @@
               url = "https://crates.io/api/v1/crates/${crateConfig.crateName}/${crateConfig.version}/download";
               sha256 = crateConfig.sha256;
             });
-            inherit features dependencies buildDependencies crateRenames;
+
+            inherit crateOverrides features dependencies buildDependencies crateRenames;
           });
     in builtByPackageId;

Building will fail with

Error: cannot coerce a set to a string, at /nix/store/xs747j6hnlyszg75qf4j7qpmascnjkkh-source/pkgs/build-support/rust/build-rust-crate/default.nix:93:5

The only thing that seems to work is if you provide a buildRustCrate as an argument to Cargo.nix as in this test:

https://github.com/kolloch/crate2nix/blob/master/sample_projects/bin_with_git_submodule_dep/default.nix

from crate2nix.

bbigras avatar bbigras commented on July 19, 2024

It works. Thanks @danieldk !

from crate2nix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.