Comments (19)
@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
from naersk.
Okay, I figured out a trick: you can override rust
to use a version with the mozilla overlay, and leave cargo
untouched. Alternatively, I imagine you can override cargo to use a nightly version of cargo in a similar fashion, I haven't tried that yet.
let rustOverlay = self: super:
let rust = (super.rustChannelOf {
channel = "1.44.0";
sha256 = "cc2f6f7515b934457bc537ed181aa04e9a844fa8567f6dae7b9403d1a5a7a09e";
}).rust; in { rustc = rust; };
from naersk.
It seems naersk stopped using unstable cargo option --out-dir
in commit 08afb3d (setting CARGO_TARGET_DIR
instead). There are still some remnants of it in docs and comments, but it seems naersk works with stable cargo now.
from naersk.
No sorry, I don't think that's right. Those options only work on nighly versions of cargo:
$ cargo --version
cargo 1.42.0 (86334295e 2020-01-31)
$ cargo -Z unstable-options build
error: the `-Z` flag is only accepted on the nightly channel of Cargo, but this is the `stable` channel
See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.
$ cargo build --out-dir foo
error: the `--out-dir` flag is unstable, and only available on the nightly channel of Cargo, but this is the `stable` channel
See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.
See https://github.com/rust-lang/cargo/issues/6790 for more information about the `--out-dir` flag.
from naersk.
Yea, I can try.
Just a little busy in my personal life for the short term.
from naersk.
Please reopen, because the PR was reverted. We are not giving up yet. :D
from naersk.
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.
from naersk.
Ok, looks like there's a pretty big demand for this! @jonringer is it something you feel like tackling?
from naersk.
Hi! Unless you've tweaked the settings, rust stable is used. Those are cargo
options, they won't impact the actual compiler. Does that help?
from naersk.
I hit the same problem when I tried to use stable rust from mozilla-overlay.
pkgs = import sources.nixpkgs {
overlays = [
nixpkgs-mozilla
(self: super:
rec {
rust = (self.rustChannelOf { date = "2020-05-07"; channel = "stable"; }).rust;
rustc = rust;
cargo = rust;
rls = rust;
}
)
];
};
from naersk.
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 ./nix/rust.nix
is stable rust from nixpkgs-mozilla), and got this far:
Finished release [optimized] target(s) in 47.03s
/nix/store/qghrkvk86f9llfkcr1bxsypqbw1a4qmw-stdenv-linux/setup: eval: line 1329: syntax error near unexpected token `||'
builder for '/nix/store/zrh0165cdhjg715xz3i2xi5r6s0l4fkm-lake-deps-0.2.0.drv' failed with exit code 2
cannot build derivation '/nix/store/8qa3543617i9jm159gp6s5ak9fr5983r-lake-0.2.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/8qa3543617i9jm159gp6s5ak9fr5983r-lake-0.2.0.drv' failed
There's got to be better ways to do this. As it currently stands, naersk is unusable with stable Cargo.
from naersk.
I also have this issue. I think that the --out-dir
flag is unstable according to this, and according to the README that flag is important.
from naersk.
Is there any movement on this as far as mainlining some form of stable
support? Taking a hard dependency on nightly
is something I'd like to avoid in production. (I also can't seem to get @jbaum98's solution working in my project, which uses niv
, but I'll keep playing with it)
from naersk.
If there's a big enough need for it I can try to figure out how to do this with cargo stable
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.
from naersk.
If there's a big enough need for it I can try to figure out how to do this with cargo stable
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 now referencing oxalica via tarball url to ensure rustc is always the latest stable, but deferring cargo's version to naersk.
I am curious if relying on the latest stable rustc and a potentially older nightly for cargo might cause any issues.
from naersk.
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.
from naersk.
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.
from naersk.
Maybe it isn't, and I just don't know about it yet. π€· :)
from naersk.
Seems like --out-dir
is not used anymore, so I'm gonna go ahead and close this issue; if something's not working as intended, please feel free to re-open π
from naersk.
Related Issues (20)
- How to cargo publish? HOT 2
- two step builds fail if CMake is used in a `build.rs` HOT 5
- Building crate that has a git submodule that is a crate that one depends on as a path dependency seems to fail? HOT 4
- no matching package named `sea-orm` HOT 4
- Cargo/rustc linker serach path when in developer shell HOT 7
- how do i build examples like cargo build --example example_name HOT 3
- Passing options to clippy HOT 2
- Monorepo with multiple crates that can not share a workspace is not possible to build? HOT 6
- Project's build.rs file not getting executed at all HOT 2
- Issues with `autocxx` in sandbox. HOT 14
- dummy-src build failed with "cp: missing file operand" HOT 4
- missing field `unused` for key `patch` HOT 1
- Error when using a `git` dependency that includes a workspace, when the flake is also in a workspace HOT 4
- `unpack-*` derivations end up in closure HOT 1
- The 'proper' way of doing a debug build? HOT 4
- Looking for a maintainer HOT 2
- Dependencies with inherited workspace info fails with parse error HOT 4
- How to build tauri with naersk? HOT 1
- Looking for a maintainer
- getting file/folder permission issue when building
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from naersk.