Git Product home page Git Product logo

Comments (9)

ebkalderon avatar ebkalderon commented on September 27, 2024 1

@evanjs Just wondering, but in this particular line of Rust:

include!(concat!(env!("OUT_DIR"), "/build.rs"));

Did you intend to write this?

include!(concat!(env!("OUT_DIR"), "/hello.rs"));

I don't think it makes sense to include!() a build script into your src/main.rs and expect it to successfully compile.

from crate2nix.

ebkalderon avatar ebkalderon commented on September 27, 2024 1

It's okay! Looks like that line was fixed when the example was committed into master anyway. ☺️

from crate2nix.

emilazy avatar emilazy commented on September 27, 2024 1

Is there any workaround for this? It's not even possible to override the src attribute for dependencies properly without patching the generated Nix file, as far as I can tell.

from crate2nix.

kolloch avatar kolloch commented on September 27, 2024 1

I submitted a pull request for that to nixpkgs: NixOS/nixpkgs#82155

If you do not want to wait for this, you can override the "workspace_member" argument of buildRustCrate which allows specifying a subdirectory.

from crate2nix.

kolloch avatar kolloch commented on September 27, 2024 1

It landed on master but not yet on nixpkgs-unstable. nixpkgs-unstable is behind roughly a week currently.

Fix is waiting here:

https://github.com/kolloch/crate2nix/tree/pkolloch-auto-workspace-member

from crate2nix.

kolloch avatar kolloch commented on September 27, 2024 1

Merged :)

from crate2nix.

kolloch avatar kolloch commented on September 27, 2024

Thank you! I can reproduce.

This is due to the crate being in a subpath. Cargo actually looks for a matching Cargo.toml, apparently:

rust-lang/cargo#1462 (comment)

That is a bit crazy but should be supportable in buildRustCrate.

Feel free to add.

from crate2nix.

evanjs avatar evanjs commented on September 27, 2024

Ah yes I suppose that wasn't the best example.
For some extra context, this is literally what I'm using right now.

pub mod systemd_manager {
    #![allow(unused)]
    include!(concat!(env!("OUT_DIR"), "/systemd_manager.rs"));
}

pub mod systemd_service {
    #![allow(unused)]
    include!(concat!(env!("OUT_DIR"), "/systemd_service.rs"));
}

I must have gotten too caught up in having a minimum reproducible example.

from crate2nix.

kolloch avatar kolloch commented on September 27, 2024

@emilazy Did you try overriding the source with defaultCrateOverrides? To be honest, I am not sure if it works but it could. I'd be really happy if you tried that out and if it worked documented it as a workaround!

I want to work on this anyways, though.

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.