!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

651 Members
Rust147 Servers

Load older messages


SenderMessageTime
23 Jul 2025
@glepage:matrix.orgGaétan Lepage
In reply to @glepage:matrix.org

Looks like rustfmt is broken on x86_64-darwin on nixos-25.05:

https://buildbot.nix-community.org/#/builders/2847/builds/5266/steps/1/logs/stdio (from Nixvim CI)

Opened a PR with a fix: https://github.com/NixOS/nixpkgs/pull/427702
15:46:30
@tomasajt:matrix.orgToma

I think we can agree that fetchCargoVendor being a two step construction is not very good for the cache.
Now, we could move the calling of the "fetch-cargo-vendor-util create-vendor" into cargoSetupHook, but that would create a dependency on fetch-cargo-vendor-util for every rust package.

Now I think I came up with a pretty clever workaround, which keeps the two layers, but makes the non-FOD layer essentially just an empty derivation except a binary that you can run to start the unpacking process.
This way we just have to detect if that unpacking binary is present in cargoDeps inside cargoSetupHook and then call it.

Though, this would make it so that we can't "easily" get derivation with the vendored dependencies unpacked from the tarball.
But, we could provide a passthru.vendorFetched (things in passthru don't get build by CI) which just runs the unpacking logic into "$out"

(Also, I put in a symlink into the non-FOD part for vendorStaging for easier access)

I made a very rudimentary POC: https://github.com/NixOS/nixpkgs/pull/427815

Note: I did not take into consideration cross/splicing

What do you all think?

17:45:49
@emilazy:matrix.orgemily"a dependency on fetch-cargo-vendor-util for every rust package" doesn't seem like an issue, does it?17:47:21
@emilazy:matrix.orgemily

90% of Rust packages will already have that dependency and it's just a lightweight Python script, yeah?

17:47:31
@emilazy:matrix.orgemily * >90% of Rust packages will already have that dependency and it's just a lightweight Python script, yeah? 17:47:36
@tomasajt:matrix.orgTomaI worry about inf-rec since the fetch-cargo-vendor-util depends on cargo, which depends on cargoSetupHook IIRC. I havr not tried it though17:50:46
@tomasajt:matrix.orgToma* I worry about inf-rec since the fetch-cargo-vendor-util depends on cargo, which depends on cargoSetupHook IIRC. I have not tried it though17:51:03
@emilazy:matrix.orgemilyusually we use overrides to solve that17:54:18
@emilazy:matrix.orgemily (cargoSetupHook.override { fetch-cargo-vendor-util = null; }) 17:54:29
@tomasajt:matrix.orgTomaTrue17:54:45
@tomasajt:matrix.orgToma

I'm assuming that some people are using a custom implementation for vendoring. (e.g. for some authentication logic IDK) and their logic assumes that cargoSetupHook expects an unpacked cargo vendor structure.
So I don't think we should unconditionally use fetch-cargo-vendor-util if we detect that cargoDeps is a directory.
We'd have to conditionally run our logic, only when we know we're using something that was generated by fetchCargoVendor
However, we can't really put any distinction marker files into vendor-staging, since that's a FOD.

But maybe I'm overthinking this.


Yes getting rid of the two steps would be healthier for easier overriding of hashes via overrideAttrs


Anyways, I have to go now... I'll be back in an hour or so, sorry!

17:59:23
@emilazy:matrix.orgemilywe could expect such users to override it out of the setup hook18:00:53
@emilazy:matrix.orgemilywe probably should have added a marker though 😅18:01:04
@emilazy:matrix.orgemilywait18:01:08
@emilazy:matrix.orgemily can't we just add a passthru.isFetchCargoVendor to fetchCargoVendor 18:01:17
@emilazy:matrix.orgemilyand add the dep and logic conditionally based on that at eval time?18:01:24
@emilazy:matrix.orgemily based on cargoDeps 18:01:34
@emilazy:matrix.orgemily oh the issue is that we don't have access to cargoDeps at that point… 18:01:39
@tomasajt:matrix.orgTomaYeah, setup hooks don't know nix values...18:03:30
@emilazy:matrix.orgemily we could condition based on the name 18:06:12
25 Jul 2025
@federicodschonborn:matrix.org@federicodschonborn:matrix.org changed their display name from Wormy McWormface 🏳️‍🌈 (he/they) to Cat McFishface 🏳️‍🌈 (he/they).01:43:15
26 Jul 2025
@oak:universumi.fioak 🏳️‍🌈♥️ changed their profile picture.08:28:46
@niklaskorz:matrix.orgniklaskorz @Toma I rebased + reran your treewide to resolve the merge conflicts, will also run nixpkgs-review for darwin and linux in a bit, but otherwise I think it’s good to go? 08:46:24
@niklaskorz:matrix.orgniklaskorzoh great already new merge conflicts since I rebased 🫠08:47:52
@niklaskorz:matrix.orgniklaskorz individual PRs removing useFetchCargoVendor by themselves makes this pretty hard 08:50:23
@niklaskorz:matrix.orgniklaskorzI’d suggest anyone reading here to stop requesting PRs to remove it themselves, except for new packages of course08:50:47
@tomasajt:matrix.orgToma
In reply to @niklaskorz:matrix.org
@Toma I rebased + reran your treewide to resolve the merge conflicts, will also run nixpkgs-review for darwin and linux in a bit, but otherwise I think it’s good to go?

As discussed earlier, we were considering waiting until https://github.com/NixOS/nixpkgs/pull/423228 gets into stable so that we can do this treewide both on stable and master, to avoid much of the backporting issues.
Though, there hasn't been a staging-next-25.05 cycle since then...

So maybe we can deal with a few backporting conflicts until then.

idk, what do you think is better?

09:27:40
@niklaskorz:matrix.orgniklaskorzmy opinion: maintainers are already removing the attribute individually in master, meaning they already have to deal with the backporting conflicts, so I think having the treewide land now is the easier approach to at least have it consistent09:29:59
@glepage:matrix.orgGaétan LepageCan someone from the Rust team (is that a thing?) ACK the PR? I don't feel like merging this beast myself.09:30:55
@emilazy:matrix.orgemily-next-25.05 is due soon09:31:19

Show newer messages


Back to Room ListRoom Version: 6