!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

651 Members
Rust147 Servers

Load older messages


SenderMessageTime
3 Dec 2025
@pyrox:pyrox.devdish [Fox/It/She]but that's the main reason to use them22:27:09
@pyrox:pyrox.devdish [Fox/It/She]since they have binary caches so you dont have to build rustc from source(which would happen if you overrode nixpkgs' rustc version)22:27:29
@neobrain:matrix.orgneobrainOh, I was thinking among the other nix options (naersk, carnix, etc) that are listed on the wiki22:32:52
@rosssmyth:matrix.orgrosssmyth

Yes!

  1. Currently if cross compiling for mingw buildRustPackage makes it a bit worse than the other builders
  2. buildRustPackage does no caching of dependencies. This means that every time you run nix build it will rebuild every dependency. The others generally do not to varying levels of granularity.

For projects I author I generally use Crane. You can do some smart caching so that it's pretty fast in CI.

22:33:06
@neobrain:matrix.orgneobrain For development I'm just going to nix develop either way 22:33:08
@neobrain:matrix.orgneobrain* Oh, I was thinking among the other nix options (naersk, crane, etc) that are listed on the wiki22:33:42
@neobrain:matrix.orgneobrainInteresting point about caching of dependencies. I would've assumed the mapping of Cargo.lock would create a separate nix store entry for each dependency (and hence trivially cache things), but I'm probably underestimating the problem space :)22:35:27
@pyrox:pyrox.devdish [Fox/It/She] sorry, thats what I meant. I see the main value prob of the {naersk,crane,fenix,etc} solutions as being that they allow using betas/nightlys if wanted 22:35:42
@pyrox:pyrox.devdish [Fox/It/She]I'm not a rust dev but that is one of the main things I've noticed22:35:52
@neobrain:matrix.orgneobrainAh, gotcha22:36:04
@pyrox:pyrox.devdish [Fox/It/She]maybe I'm wrong in that way but from my usage in the past thats been my reason to use them22:36:10
@pyrox:pyrox.devdish [Fox/It/She]* maybe I'm wrong in that way but from my usage in the past thats been my reason to use them over buildRustPackage22:36:13
@pyrox:pyrox.devdish [Fox/It/She]since I just use cargo during active dev22:36:42
@rosssmyth:matrix.orgrosssmyth

For an example of the caching, you can see what I did with Wild. Basically the assumption is "the Cargo.lock and flake.lock files do not change very often (compared to the rest of the souce)"

So there's a dedicated job that refreshes the cache when the lockfiles change
Then another job for running with the cached dependencies
And a cron job to periodically update the flake lockfile

22:37:03
@rosssmyth:matrix.orgrosssmyth You can use nightly and beta with buildRustPackage just as easily as the other options, so I wouldn't really say that's an advantage. It's even shown in the reference how to 22:38:21
@rosssmyth:matrix.orgrosssmythYou just can't in Nixpkgs22:38:34
@neobrain:matrix.orgneobrain rosssmyth: How do you handle day-to-day development? Do you enter a nix shell or do you always nix run/build? If it's purely the former, I'm guessing the main benefit of the caching is for CI? 22:39:26
@neobrain:matrix.orgneobrain * rosssmyth: How do you handle day-to-day development? Do you enter a nix shell (and then use Cargo manually) or do you always nix run/build? If it's purely the former, I'm guessing the main benefit of the caching is for CI? 22:39:45
@rosssmyth:matrix.orgrosssmyth The packages that allow it are rust-overlay and the other one I can't remember
https://nixos.org/manual/nixpkgs/unstable/#using-rust-nightly-in-a-derivation-with-buildrustpackage
22:40:03
@rosssmyth:matrix.orgrosssmythGenerally both. The caching in CI is pretty much always a win, then caching when I'm just doing day-to-day dev is also great cause I always like to verify that things build alright in the sandbox when I'm developing 22:41:26
@marienz:matrix.orgMarien Zwart
In reply to @rosssmyth:matrix.org
The packages that allow it are rust-overlay and the other one I can't remember
https://nixos.org/manual/nixpkgs/unstable/#using-rust-nightly-in-a-derivation-with-buildrustpackage
https://github.com/nix-community/fenix ?
22:42:22
@rosssmyth:matrix.orgrosssmythyeah22:42:30
@neobrain:matrix.orgneobrainI see, makes sense. Thanks for the explanation!22:43:29
4 Dec 2025
@i-am-logger:matrix.orgIdo Samuelson joined the room.01:45:35
@onur-ozkan:matrix.orgonur-ozkan joined the room.04:20:40
@curid:matrix.org@curid:matrix.org left the room.08:59:20
@isabel:isabelroses.comisabel changed their profile picture.16:42:04
@tanja:catgirl.cloudTanja (she/her) - ☎️ 4201 changed their display name from Tanja (she/her) to Tanja (she/her) - ☎️ 4201.18:09:36
5 Dec 2025
@hive:the-apothecary.club👉@crystallinefire:chat.solarpunk.moe changed their display name from EVA-01 to 👉@crystallinefire:chat.solarpunk.moe.17:17:01
7 Dec 2025
@magnetophon:matrix.orgmagnetophon joined the room.13:39:01

Show newer messages


Back to Room ListRoom Version: 6