!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

680 Members
Rust154 Servers

Load older messages


SenderMessageTime
8 Feb 2022
@akadude:matrix.orgakadude This works! General question: is there a place where I can find full documentation on these things? Like, if I was writing a buildscript in Shake, haddock+official tutorial would be pretty much everything I need. But in Nix's case, even https://nixos.org/manual/nixpkgs/stable/#compiling-rust-applications-with-cargo doesn't say anything about makeRustPlatform and what kind of keys it accepts. Ideally, I think, I want typed documentation :) 11:01:35
@akadude:matrix.orgakadude Also, the manual mentions carnix, but you didn't. Is there something wrong with it? I want to give it a try, since my current default.nix doesn't cache at all 11:06:58
@zhaofeng:zhaofeng.liZhaofeng Li
In reply to @akadude:matrix.org
This works! General question: is there a place where I can find full documentation on these things? Like, if I was writing a buildscript in Shake, haddock+official tutorial would be pretty much everything I need. But in Nix's case, even https://nixos.org/manual/nixpkgs/stable/#compiling-rust-applications-with-cargo doesn't say anything about makeRustPlatform and what kind of keys it accepts. Ideally, I think, I want typed documentation :)
Sadly the documentations can be pretty hit-and-miss and you often need to read the soruces. In this case I think it's very valuable to have some docs for makeRustPlatform and you can send a PR.
17:35:29
@zhaofeng:zhaofeng.liZhaofeng Li
In reply to @akadude:matrix.org
Also, the manual mentions carnix, but you didn't. Is there something wrong with it? I want to give it a try, since my current default.nix doesn't cache at all
I think it was one of the earlier attempts and no longer maintained: https://github.com/nix-community/carnix
17:36:33
9 Feb 2022
@drupol:matrix.orgPol
In reply to @mixedCase:matrix.org
Hey everyone. I'm trying to start a Rust project and would like to have Nix working from the start. Is there any boilerplate for this that's more up to date than https://github.com/srid/rust-nix-template?
yes ! https://github.com/tkellogg/dura <- see there the flake.nix. Also, if you would like to hack into rust in a few minutes from any Nix powered machine, just do: nix develop github:loophp/rust-shell#stable-default
17:41:52
@drupol:matrix.orgPolFind more documentation about loophp/rust-shell here: https://github.com/loophp/rust-shell17:43:56
@mixedCase:matrix.orgAndrés Rodríguez
In reply to @drupol:matrix.org
yes ! https://github.com/tkellogg/dura <- see there the flake.nix. Also, if you would like to hack into rust in a few minutes from any Nix powered machine, just do: nix develop github:loophp/rust-shell#stable-default
Oooh! Thanks for looping me in! So that means naersk is now fully deprecated by this nixpkgs module?
17:44:36
@drupol:matrix.orgPolYou're welcome! About Naersk, I never said that :)17:44:58
@drupol:matrix.orgPolI don't even know if it is or not.17:45:08
@drupol:matrix.orgPolTBH, loophp/rust-shell is very handy for me and my colleagues to quickly hack with Rust and Idea Ultimate.17:46:12
@mixedCase:matrix.orgAndrés RodríguezWell, don't know about fully replacing Naersk, but I just tried it out and my project builds just fine with this instead of Naersk, so I'm going to stick with it at least for the moment :D Thanks again!17:54:53
@mikroskeem:d0.eeMarknaersk and rustPlatform.buildRustPackage both work fine, just bit different18:24:41
@mikroskeem:d0.eeMarknaersk is similar to carnix, but uses IFD instead of nix codegen iirc - both download crates using nix18:25:25
@mikroskeem:d0.eeMarkrustPlatform.buildRustPackage vendors everything into one big tarball18:25:47
@mikroskeem:d0.eeMarkif you have many rust projects sharing same dependencies, you could benefit more from naersk18:26:19
@mikroskeem:d0.eeMarkbut then again storage is somewhat cheap18:26:41
@jonringer:matrix.orgjonringer If it's out-of-tree code, you can do rustPlatform.buildRustPackage + cargoFile, so you don't need FOds 18:45:04
@jonringer:matrix.orgjonringer the main thing with nixpkgs is that it had restrict-eval, so you can't do something like https://github.com/jonringer/nix-template/blob/4d852a1f72b5a8c0d79b8e6b7d5809c66414c12d/nix/nix-template.nix#L8 18:45:52
@jonringer:matrix.orgjonringer * the main thing with nixpkgs is that it has restrict-eval, so you can't do something like https://github.com/jonringer/nix-template/blob/4d852a1f72b5a8c0d79b8e6b7d5809c66414c12d/nix/nix-template.nix#L8 18:46:09
@aktaboot:matrix.orgaktaboot changed their profile picture.23:51:14
10 Feb 2022
@x10an14:matrix.orgx10an14 joined the room.11:33:17
@x10an14:matrix.orgx10an14

Is there any "low barrier of entry" flake template one can utilize to get a flaked rust nix project where

  1. direnv/nix develop works - and appends to $PATH, as opposed to overwriting it? (my experience with naersk)
  2. Gives (maybe even documents) an easy-to-find list where one can add nix packages such as cargo-edit?
12:20:59
@x10an14:matrix.orgx10an14

I've been looking at the below, and I feel like they're out of my competency/comfort zone:

  • https://github.com/yusdacra/nix-cargo-integration
  • https://github.com/numtide/devshell
  • https://github.com/nmattia/naersk
  • https://github.com/loophp/rust-shell/
12:22:40
@tomberek:matrix.orgtomberek x10an14: it's not a template, but I've been hacking on this project and it's been nice, should be easy to adopt. https://github.com/kamadorueda/alejandra/blob/main/flake.nix 14:54:14
@x10an14:matrix.orgx10an14
In reply to @tomberek:matrix.org
x10an14: it's not a template, but I've been hacking on this project and it's been nice, should be easy to adopt. https://github.com/kamadorueda/alejandra/blob/main/flake.nix

Thanks! I'll take a closer look later today =)

This is where I ended up meanwhile after lots of bashing forehead against the dreaded learning curve's wall: https://git.sr.ht/~x10an14/pass-steam/tree/main/item/flake.nix
(Not sure I really understand it yet, but it works for most. Just breaks bash-completion unfortunately).

14:58:30
11 Feb 2022
@x10an14:matrix.orgx10an14 Anyone here willing to help me along debugging/figuring out Windows cross-compile? https://paste.sr.ht/~x10an14/1f03145beafb08f682f88b414bf174a7c2491504 I've searched and found some tips at both fenix and naersk, with the respective fixes/suggestions mentioned in my flake.nix to no avail =/ 14:47:12
@tomberek:matrix.orgtomberek x10an14: i was going to have some office hours this afternoon and also working on getting rust to cross compile something to musl. Haven't done windows yet, but would be good to clarify. 18:09:08
@tomberek:matrix.orgtomberek x10an14: available? 22:27:35
@x10an14:matrix.orgx10an14
In reply to @tomberek:matrix.org
x10an14: available?
In an hour or two? Not right now =( Thanks for reaching out though!
22:28:54
@x10an14:matrix.orgx10an14Are the office hours gonna be updated here (or somewhere else) moving forwards? https://discourse.nixos.org/t/nix-office-hours/11945/4522:29:33

Show newer messages


Back to Room ListRoom Version: 6