!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

686 Members
Rust153 Servers

Load older messages


SenderMessageTime
1 May 2025
@jaen:matrix.orgjaen Hello, anybody knows if there's a way with Crane (or anything else, really, it's just what I started out with) to have two separate Crago projects, repos/dep and repos/app and have it somehow provide dep to app when doing cargo build without having to change it to a path dependency in Cargo.toml? I've seen something about registry injection in the docs, but it seems that only works for actual, hosted registries and I don't see a way to inject a dependency built separately that way. And so far haven't found anything promising other than that yet. I'm basically trying to see if I can develop two (or more) things side-by-side without forcing any of the projects to be aware of the other at Rust level (my nix setup is external to the projects), so I don't have to worry about accidentally sending some local changes upstream. 14:17:58
@jaen:matrix.orgjaen Also, incidentally, anybody has a good guide/flowchart/checklist/something that makes it easier to know how to structure your data in Rust, especially in a concurrent setting? I've been following the language from back when it was still written in OCaml, so I'd say I have a reasomable high-level understanding of it's concepts, but I also never ended up writing anything non-trivial in it, so I haven't really developed a practical intuition for all those concepts. And when you're trying to write something non-trivial it quickly gets painful — is reference enough in this case or not, should I keep annotating things with lifetimes until it compiles or is that overkill, it seems I'm running afoul of the "multiple immutable XOR single mutable" thing should I maybe use some smart pointer type instead or refactor the code and if so then how, okay I guess I should use Arc<RwLock<_>> but now I have borrow_mut() littered everywhere and for some reason it still thinks my lock guard lives longer than it feels to me it does. This kind of stuff. If there's anything that got any of y'all over this hump and into actuall knowing how to work with the language to structure your data properly, I'd appreciate links. 14:18:07
@charles:computer.surgeryCharles For general rust stuff you may be interested in joining #rust:matrix.org 18:20:03
@charles:computer.surgeryCharlesFor the first message maybe you just want to use cargo's git dependencies feature to depend on the stuff from the other repo18:21:02
@charles:computer.surgeryCharlesIt's not really clear to me what exactly you're trying to achieve. You have two unrelated git repos with rust projects and you want to tie them together in a third repository with nix code?18:22:28
@charles:computer.surgeryCharles* It's not really clear to me what exactly you're trying to achieve. You have two unrelated git repos with unrelated rust projects and you want to tie them together in a third repository with nix code?18:23:07
@philipdb:matrix.orgPhiliPdB joined the room.19:26:25
@rosariopulella:matrix.orgRosuavio changed their display name from Rosario Pulella to Rosuavio.20:09:25
@jaen:matrix.orgjaen Managed to get some tips on one of Rust discords, so feel a bit unstuck there, hopefully that sticks. For the latter, yeah, kind of. To maybe make this more concrete, I want to try to work on building Android with dynamic derivations — so there's nix-ninja, which uses n2, a ninja successor in Rust and possibly I will need to make some improvements to crates it uses (e.g. the memmap2 crate) and ultimately there will be some nix code, that uses all this to build Android incrementally with nix. The nix part will use nix-ninja, that's pretty simple, just export the binary under packages and use that in the nix code, but it will in turn use n2 as a library and similarly for any dependencies I want to improve. I don't control any of that code (except whatever nix I will write) and I hope to be able to upstream as much as possible, so I want to avoid making any changes to the repos that won't be upstreamable and I'd have to rebase over and over again to keep them. Not too fond of having to keep pushing my changes to a repo, instead of working with them locally either. Which is why I thought I could try to leverage nix to somehow tie them together in a meta workspace of sorts, but so far I haven't seen an easy way to tell crane "see, this crate that I have in a git submodule at repos/n2 wants to use memmap2 from there, but can you instead inject a crate built from repos/memmap2 you have locally?". Hopefully that makes more sense now? 20:40:22
@oak:universumi.fioak 🏳️‍🌈♥️ changed their display name from oak - mikatammi.fi to oak 🫱⭕🫲.23:18:16
3 May 2025
@rucadi_:matrix.orgRucadi joined the room.18:19:13
@soundhead:matrix.orgsoundhead joined the room.19:22:35
4 May 2025
@oneeyed:matrix.orgSam changed their display name from Sam (away → 5/5) to Sam.15:42:02
@etcpanda:matrix.org@etcpanda:matrix.org left the room.19:24:19
@rucadi_:matrix.orgRucadi changed their display name from Ruben Cano Díaz to Rucadi.23:18:43
5 May 2025
@federicodschonborn:matrix.org@federicodschonborn:matrix.org changed their display name from This legally distinct plastic brick is licensed under the terms of the he/him or they/them pronouns, at your choice to This LEGO© Worm™ is licensed under the terms of the he/him or they/them pronouns, at your choice.20:48:53
6 May 2025
@penguin_brian:matrix.orgBrian MayI seem to sometimes get random rust errors building my code inside a Nix flake using Crane. Every attempt to build I get a different error in a different Cargo dependency until it eventually "just works". rustc compiler panics are a regular thing. As is E0080 errors (in random places). Then on my next attempt it compiled successfully like there was nothing ever wrong. Any ideas? I still have the screen logs, but it just seems so random. Although errors in js-sys and icu_provider are common. It is more likely to build in the original flake, as opposed to another flake which uses the first flake as an input. Once it builds the second flake can use the cached copy. This is using rust 1.86.0 and using nix 24.1103:19:24
@penguin_brian:matrix.orgBrian May * I seem to sometimes get random rust errors building my code inside a Nix flake using Crane. Every attempt to build I get a different error in a different Cargo dependency until it eventually "just works". rustc compiler panics are a regular thing. Also E0080 errors (in random places). Then on my next attempt it compiled successfully like there was nothing ever wrong. Any ideas? I still have the screen logs, but it just seems so random. Although errors in js-sys and icu_provider are common. It is more likely to build in the original flake, as opposed to another flake which uses the first flake as an input. Once it builds the second flake can use the cached copy. This is using rust 1.86.0 and using nix 24.11 03:20:31
@curid:matrix.org@curid:matrix.orgoom?05:28:42
@penguin_brian:matrix.orgBrian May

That is a theory I had. But I suspect that is extremely unlikely on this machine with 128GB ram :-)

               total        used        free      shared  buff/cache   available
Mem:           125Gi        77Gi        43Gi       221Mi       7.9Gi        48Gi
Swap:          511Gi       7.9Gi       504Gi
05:34:21
@curid:matrix.org@curid:matrix.orghow big is the tmp directory?05:34:55
@penguin_brian:matrix.orgBrian May
# df -h /tmp
Filesystem      Size  Used Avail Use% Mounted on
rpool/nixos     2.8T  165M  2.8T   1% /

Think that should be fine. Unless I missed something. It is zfs. Hmm. Wonder if that could be significant. Didn't think of that.

05:35:49
@oak:universumi.fioak 🏳️‍🌈♥️ Could someone invite me to #users:nixos.org please? 08:38:35
@oak:universumi.fioak 🏳️‍🌈♥️I'm annoyed because I cannot join :(08:38:53
@federicodschonborn:matrix.org@federicodschonborn:matrix.org changed their display name from This LEGO© Worm™ is licensed under the terms of the he/him or they/them pronouns, at your choice to This LEGO® Worm™ is licensed under the terms of the he/him or they/them pronouns, at your choice.09:13:23
@k900:0upti.meK900Done09:16:33
@theowlfarm:matrix.orgtheowlfarmI would also like an invite please. Why was it made invite only?09:34:57
@marie:marie.cologneMarie sent you an invite, because of spam attacks 09:36:28
@theowlfarm:matrix.orgtheowlfarmthank you09:36:51
@pinkybrain:matrix.orgpinkybrain joined the room.22:56:36

Show newer messages


Back to Room ListRoom Version: 6