!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

696 Members
Rust157 Servers

Load older messages


SenderMessageTime
13 Feb 2025
@niklaskorz:korz.devNiklas KorzBut I might have been looking in the wrong corner of rustc14:36:59
@qyliss:fairydust.spaceAlyssa RossIIRC the problem was that it didn't accomodate the possibility that you'd be building std and no_std targets at the same time.14:37:22
@emilazy:matrix.orgemily Alyssa Ross: does this look like anything familiar? https://hydra.nixos.org/build/288008080/nixlog/1 looks like it broke when the useFetchCargoVendor cycle landed 14:38:20
@emilazy:matrix.orgemily(going to investigate myself at some point since I theoretically maintain it, but maybe it's something obvious/known)14:38:39
@emilazy:matrix.orgemily cc Toma 14:38:51
@niklaskorz:korz.devNiklas Korz
In reply to @qyliss:fairydust.space
IIRC the problem was that it didn't accomodate the possibility that you'd be building std and no_std targets at the same time.
I'll have another look if I can nail it down
14:40:33
@tomasajt:matrix.orgToma
In reply to @emilazy:matrix.org
Alyssa Ross: does this look like anything familiar? https://hydra.nixos.org/build/288008080/nixlog/1 looks like it broke when the useFetchCargoVendor cycle landed

finalAttrs.cargoDeps.patches is no longer valid (maybe null, idk can't check rn), since patches gets passed into cargoDeps.vendorStaging

there should probably be a way to pass attrs to the non-staging drv. Though, in this case we actually need to pass to the staging FOD.
So the fix is probably just using finalAttrs.cargoDeps.vendorStaging.patches

15:31:23
@tomasajt:matrix.orgToma--- Btw are we still considering renaming fetchCargoVendor? If yes, we probably need a better name than .vendorStaging. Ideas: .staging, .stage, .fod anyone have better names?15:35:55
@emilazy:matrix.orgemily did I already suggest .sources? 15:48:19
@emilazy:matrix.orgemily or even .src, since it's somewhat analogous to a normal derivation's src 15:49:02
@fooker:maglab.spacefooker joined the room.19:00:38
14 Feb 2025
@niklaskorz:korz.devNiklas Korzhm, tried compiling on rustc master outside nix and that worked out fine with aarch64-darwin + bpfel-unknown-none in the same config22:12:46
@niklaskorz:korz.devNiklas Korzwill try again with 1.84.022:13:01
@niklaskorz:korz.devNiklas Korz never mind that, forgot that ./x.py build and ./x.py doc are separate commands 22:28:30
@niklaskorz:korz.devNiklas Korz Alyssa Ross: I think I found the bug in bootstrap and have a fix... while it does have explicit no_std handling, that behavior seems to not have been tested for for doc but only for build: it returns an empty vec of crates to document, which the documentation stage then interprets as "all libraries" instead of "no libraries" 23:01:32
@niklaskorz:korz.devNiklas Korzso the fix is to skip the documentation stage for any targets that return the empty vec23:01:50
@niklaskorz:korz.devNiklas KorzI'm sure upstream has a more thorough explanation for this and can probably come up with an even better solution once I propose it there, but it should be enough to unblock adding bpfe targets without causing any issues to the other targets23:02:30
@niklaskorz:korz.devNiklas Korz

so the fix is literally just:

diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs
index 8a9321f8e79..4bd212660dd 100644
--- a/src/bootstrap/src/core/build_steps/doc.rs
+++ b/src/bootstrap/src/core/build_steps/doc.rs
@@ -588,6 +588,9 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
 
     fn make_run(run: RunConfig<'_>) {
         let crates = compile::std_crates_for_run_make(&run);
+        if crates.is_empty() {
+            return;
+        }
         run.builder.ensure(Std {
             stage: run.builder.top_stage,
             target: run.target,

23:12:20
@niklaskorz:korz.devNiklas KorzI'll open a staging PR with that + adding the bpfe targets in sec23:15:42
15 Feb 2025
@rosssmyth:matrix.orgrosssmyth

If I were to try and solve the issue of cross compiling for windows and pthreads (see https://github.com/NixOS/nixpkgs/issues/139966), what would be the best way to go about it? I would prefer to fix it so that it works with cargoBuildHook since I use that at work. Pretty much every Rust project I work on runs into this as all are crossed to Windows.

My best thought so far is to add a default CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS = "-L native=${windows.pthreads}/lib" + args; or something in the build hook though I've not tried it yet.

03:16:34
@benjb83:matrix.orgBenjB83 joined the room.10:15:20
@benjb83:matrix.orgBenjB83 changed their display name from Benjamín Buske to BenjB83.10:43:24
@reckenrode:matrix.orgRandy Eckenrode If you need to build a binary for the build platform, you need GCC, Rust, and Cargo in depsBuildBuild. 12:45:53
16 Feb 2025
@kristijan.zic:matrix.orgKristijanZic joined the room.01:03:24
17 Feb 2025
@xiaoxiangmoe:matrix.org🐰 xiaoxiangmoehttps://github.com/NixOS/nixpkgs/pull/382251#pullrequestreview-261940712804:28:59
@xiaoxiangmoe:matrix.org🐰 xiaoxiangmoeIt seems that nix darwin fetch-cargo-vendor is broken04:30:24
@tlater:matrix.tlater.nettlater joined the room.07:46:17
@tlater:matrix.tlater.nettlater

o/ hoping for a bit of advice, I'm currently trying to set up a CI flow with crate2nix to test some code.

The tests involve spinning up a test environment with docker compose, though, so simply adding runTests won't work.

I'm using cargo nextest as a test runner, so AIUI in theory I should be able to build my tests (with cargo nextest run --no-run from a high level perspective) with nix, make the test binaries themselves the build output, and then outside of the nix context invoke cargo nextest run to actually run the tests.

Does this seem like a reasonable approach? Could it be something crate2nix is interested in as a supported use case? Any other ideas on how to handle tests like this?

07:52:47
@antifuchs:asf.computerantifuchsIf you’re doing encapsulated end-to-end tests, I can highly recommend nixos vm-based tests. There’s some really good write-ups out there, including my own mediocre one, https://boinkor.net/2024/02/saved-by-nixos-integration-tests-surprisingly/12:45:15
@antifuchs:asf.computerantifuchsThis means extracting your e2e testing from rust tests, but you gain stuff like more realistic networking between your components12:48:35

Show newer messages


Back to Room ListRoom Version: 6