-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible for naersk to use stable Rust #100
Comments
Hi! Unless you've tweaked the settings, rust stable is used. Those are |
No sorry, I don't think that's right. Those options only work on nighly versions of cargo:
|
I hit the same problem when I tried to use stable rust from mozilla-overlay.
|
Thirding this. Tried: { sources ? import ./nix/sources.nix
, pkgs ? import sources.nixpkgs {} }:
let
rust = import ./nix/rust.nix { inherit sources; };
naersk = pkgs.callPackage sources.naersk {
rustc = rust;
cargo = rust;
};
# tell nix-build to ignore the "target" directory
src = builtins.filterSource
(path: type: type != "directory" || builtins.baseNameOf path != "target")
./.;
in naersk.buildPackage {
inherit src;
cargoOptions = v: [];
cargoBuildOptions = v: [ "$cargo_release" ''-j "$NIX_BUILD_CORES"''
"--message-format=$cargo_message_format"];
cargoBuild = v: ''
OUT_DIR=out cargo $cargo_options build $cargo_build_options >> $cargo_build_output_json
'';
remapPathPrefix = true; # remove nix store refs
} (where
There's got to be better ways to do this. As it currently stands, naersk is unusable with stable Cargo. |
I also have this issue. I think that the |
Okay, I figured out a trick: you can override let rustOverlay = self: super:
let rust = (super.rustChannelOf {
channel = "1.44.0";
sha256 = "cc2f6f7515b934457bc537ed181aa04e9a844fa8567f6dae7b9403d1a5a7a09e";
}).rust; in { rustc = rust; }; |
Is there any movement on this as far as mainlining some form of |
@klardotsh as mentioned above, I believe this only requires cargo nightly, not rustc nightly. Is this acceptable for you? If there's a big enough need for it I can try to figure out how to do this with cargo stable, please 👍 if you're interested |
I'm using flakes and haven't been able to figure out how to use a stable version of the rust toolchain from nixpkgs but use a compatible nightly build version of cargo yet. I'll post here if I get something that works. |
I also ran into this when switching from nightly to stable. I would appreciate it if I could use the very same version of the rust toolchain during development and packaging, regardless of the rust channel. |
I was also thinking about this. I am curious if relying on the latest stable rustc and a potentially older nightly for cargo might cause any issues. |
Seems like a simple thing to fix so I gave it a try and now I have a PR. So far it works for me. |
Oh wow, thanks @dpc. If the fix is this simple, I'm embarrassed I didn't come up with it in my efforts before opening the issue last year. |
Maybe it isn't, and I just don't know about it yet. 🤷 :) |
Ok, looks like there's a pretty big demand for this! @jonringer is it something you feel like tackling? |
Yea, I can try. Just a little busy in my personal life for the short term. |
Please reopen, because the PR was reverted. We are not giving up yet. :D |
It seems naersk stopped using unstable cargo option |
Remove workaround for nix-community/naersk#100 that is no longer needed.
Seems like |
Hi apologies for my naïvety. I'm very new to Nix.
All the instructions I have found so far describe using nightly rust with naersk. I would rather use a release version of stable rust. Is this possible?
I tried removing
"-Z" "unstable-options"
fromcargoOptions
but it seems that was there to allow the use of--out-dir
. Can the CARGO_TARGET_DIR be used instead?The text was updated successfully, but these errors were encountered: