| 7 Feb 2025 |
Ilan Joselevich (Kranzes) | * | 00:00:00 |
mindtree | Yeah I looked for this initially, but I wasn't able to find a way to override the flag 🤔
I originally tried something like:
cargoBuildFlags = [ "--target" "wasm32-unknown-unknown" ];
but then the actual build command just ended up with two commands: one for aarch64-apple-darwin and another for wasm32-unknown-unknown.
That lead me to these docs mentioning that the target is derived from the stdenv.hostPlatform.rust.rustcTarget, and digging into that eventually lead me to pkgsCross.wasm32-unknown-none.
Sidenote: I'm very curious about buildRustCrate btw - will have to investigate that another night!
| 00:04:27 |
Ilan Joselevich (Kranzes) | Don't bother with buildRustCrate and crate2nix | 00:05:11 |
mindtree | * Yeah I looked for this initially, but I wasn't able to find a way to override the flag 🤔
I originally tried something like:
cargoBuildFlags = [ "--target" "wasm32-unknown-unknown" ];
but then the actual build command just ended up with two targets: one for aarch64-apple-darwin and another for wasm32-unknown-unknown.
That lead me to these docs mentioning that the target is derived from the stdenv.hostPlatform.rust.rustcTarget, and digging into that eventually lead me to pkgsCross.wasm32-unknown-none.
Sidenote: I'm very curious about buildRustCrate btw - will have to investigate that another night!
| 00:05:38 |
Ilan Joselevich (Kranzes) | If you can handle the lack of granularity of buildRustPackage stick to it | 00:05:45 |
Ilan Joselevich (Kranzes) | In reply to @kranzes:matrix.org Don't bother with buildRustCrate and crate2nix I think they're doomed | 00:06:00 |
Ilan Joselevich (Kranzes) | Crane maybe fine because it's still cargo | 00:06:11 |
Ilan Joselevich (Kranzes) | But reimplementing cargo in Nix is miserable | 00:06:31 |
Ilan Joselevich (Kranzes) | Way too much work and practically impossible to get right | 00:06:48 |
Ilan Joselevich (Kranzes) | Anyway, figure out how to do that cross compilation with rustPlatform | 00:08:45 |
mindtree | Got this working! Posted a small tutorial on the forum thread:
https://discourse.nixos.org/t/building-a-rust-package-derivation-using-buildrustpackage-for-wasm32-unknown-unknown/59925/2?u=mindtree | 01:05:39 |
| Lim, Thing-han joined the room. | 03:34:18 |
| terrorjack left the room. | 22:28:01 |
| diamond (it/its) changed their profile picture. | 23:10:50 |
| diamond (it/its) changed their profile picture. | 23:18:50 |
| diamond (it/its) changed their profile picture. | 23:19:57 |
| 8 Feb 2025 |
| terrorjack joined the room. | 01:18:22 |
| terrorjack set a profile picture. | 02:24:24 |
| terrorjack removed their profile picture. | 02:25:00 |
mindtree | Update: while the above^ works on aarch64-darwin as the build machine, I'm now running into issues when using x86_64-linux as the build machine.
It looks like even when just building a hello-world rust program with rustPlatform.buildrustPackage via pkgs.pkgsCross.wasm32-unknown-none.callPackage, it starts compiling LLVM and then rustc from scratch.
This was kind of expected after my experience on my mac, where the same happened, however on the mac they at least complete successfully after an hour or two. On my linux build machine, rustc fails to build during the bootstrap phase with a libunwind .so not found error.
Shouldn't llvm and rustc be cached for the pkgsCross.wasm32-unknown-none? Perhaps they're not, because there are no packages that actually use pkgsCross.wasm32-unknown-none, so as a result hydra never builds and caches them?
If so, what would be the best way to get hydra testing and building these? Would I need to add some simple hello-world-rust-wasm32-unknown-none package to pkgs/by-name/he/ or something along these lines?
I guess working out why rustc won't build is another issue, but at least with some basic package
Also, another thing I'm noticing is that regardless of what I put in meta.platforms, it always says the system is unsupported when building with pkgsCross.wasm32-unknown-none, and I always have to add NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 and --impure everytime I build 🫠I might look into addressing this too.
| 12:34:22 |
mindtree | * Update: while the above^ works on aarch64-darwin as the build machine, I'm now running into issues when using x86_64-linux as the build machine.
It looks like even when just building a hello-world rust program with rustPlatform.buildrustPackage via pkgs.pkgsCross.wasm32-unknown-none.callPackage, it starts compiling LLVM and then rustc from scratch.
This was kind of expected after my experience on my mac, where the same happened, however on the mac they at least complete successfully after an hour or two. On my linux build machine, rustc fails to build during the bootstrap phase with a libunwind .so not found error.
Shouldn't llvm and rustc be cached for the pkgsCross.wasm32-unknown-none? Perhaps they're not, because there are no packages that actually use pkgsCross.wasm32-unknown-none, so as a result hydra never builds and caches them?
If so, what would be the best way to get hydra testing and building these? Would I need to add some simple hello-world-rust-wasm32-unknown-none package to pkgs/by-name/he/ or something along these lines?
I guess working out why rustc won't build is another issue.
Also, another thing I'm noticing is that regardless of what I put in meta.platforms, it always says the system is unsupported when building with pkgsCross.wasm32-unknown-none, and I always have to add NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 and --impure everytime I build 🫠I might look into addressing this too.
| 13:04:21 |
mindtree | * Update: while the above^ works on aarch64-darwin as the build machine, I'm now running into issues when using x86_64-linux as the build machine.
It looks like even when just building a hello-world rust program with rustPlatform.buildrustPackage via pkgs.pkgsCross.wasm32-unknown-none.callPackage, it starts compiling LLVM and then rustc from scratch.
This was kind of expected after my experience on my mac, where the same happened, however on the mac they at least complete successfully after an hour or two. On my linux build machine, rustc fails to build during the bootstrap phase with a libunwind .so not found error.
Shouldn't llvm and rustc be cached for the pkgsCross.wasm32-unknown-none? Perhaps they're not, because there are no packages that actually use pkgsCross.wasm32-unknown-none, so as a result hydra never builds and caches them?
If so, what would be the best way to get hydra testing and building these? Would I need to add some simple hello-world-rust-wasm32-unknown-none package to pkgs/by-name/he/ or something along these lines?
I guess working out why rustc won't build is another issue, but at least having some basic pkg in nixpkgs would help to ensure it stays working.
Also, another thing I'm noticing is that regardless of what I put in meta.platforms, it always says the system is unsupported when building with pkgsCross.wasm32-unknown-none, and I always have to add NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 and --impure everytime I build 🫠I might look into addressing this too.
| 13:04:36 |
mindtree | * Update: while the above^ works on aarch64-darwin as the build machine, I'm now running into issues when using x86_64-linux as the build machine.
It looks like even when just building a hello-world rust program with rustPlatform.buildRustPackage via pkgs.pkgsCross.wasm32-unknown-none.callPackage, it starts compiling LLVM and then rustc from scratch.
This was kind of expected after my experience on my mac, where the same happened, however on the mac they at least complete successfully after an hour or two. On my linux build machine, rustc fails to build during the bootstrap phase with a libunwind .so not found error.
Shouldn't llvm and rustc be cached for the pkgsCross.wasm32-unknown-none? Perhaps they're not, because there are no packages that actually use pkgsCross.wasm32-unknown-none, so as a result hydra never builds and caches them?
If so, what would be the best way to get hydra testing and building these? Would I need to add some simple hello-world-rust-wasm32-unknown-none package to pkgs/by-name/he/ or something along these lines?
I guess working out why rustc won't build is another issue, but at least having some basic pkg in nixpkgs would help to ensure it stays working.
Also, another thing I'm noticing is that regardless of what I put in meta.platforms, it always says the system is unsupported when building with pkgsCross.wasm32-unknown-none, and I always have to add NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 and --impure everytime I build 🫠I might look into addressing this too.
| 13:22:10 |
Alyssa Ross | well, they can't be cached if they don't build | 17:55:19 |
Alyssa Ross | the thing with Hydra "testing" things is that it's only helpful if somebody is actively monitoring Hydra to see if something stops building, because Hydra doesn't do anything to notify of failed builds | 17:56:30 |
Tristan Ross | It would be useful if it could but then emails would be flooded and likely ignored. | 18:09:11 |
| 9 Feb 2025 |
| @tired:fairydust.space left the room. | 22:50:47 |
| 10 Feb 2025 |
rhelmot | does anyone wanna explain how the splicing internals work to me | 03:58:07 |
Artturin | Easy, it's just adding attrs on top of the package set | 03:58:47 |
Artturin | From other offset package sets | 03:59:12 |