!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

707 Members
Rust158 Servers

Load older messages


SenderMessageTime
11 Feb 2025
@ahamon:matrix.orgAndy Hamon

but the advice in the manual says use crossSystem. I tried doing roughly this:

      rustTargetOverride = {rust.rustcTarget = "aarch64-apple-ios";};
      crossSystem = (lib.systems.elaborate "aarch64-darwin") // rustTargetOverride;

My rationale being "I just want to change the target for rustc"

03:22:36
@ahamon:matrix.orgAndy Hamonbut that results in an infinite loop. and i've realized by rationale was flawed, since i don't want to change rustc everywhere, only for my one target03:23:06
@ahamon:matrix.orgAndy Hamon* but that results in an infinite loop. and i've realized by rationale was flawed, since i don't want to change rustc everywhere, only for my one target (and perhaps its dependencies)03:23:17
@ahamon:matrix.orgAndy Hamonon the verge of giving up and doing a fixed-output runCommand that just invokes cargo in the way I want04:04:23
@ahamon:matrix.orgAndy Hamonactually I have something working!!!04:40:29
@ahamon:matrix.orgAndy Hamonwith crate2nix04:40:43
@ahamon:matrix.orgAndy Hamonvery jank though04:40:46
@ahamon:matrix.orgAndy Hamon crate2nix lets you override the impl of buildRustCrate. So I made an impl with transforms arguments on the way in and tacks on extraRustcOpts = ["--target aarch64-apple-ios"]; 04:42:27
@ahamon:matrix.orgAndy Hamon(and I already have a custom rustPlatform from rust-overlay which has additional targets added)04:44:47
@ahamon:matrix.orgAndy Hamon not toooo worried about a lack of correctness here from a cross compiling point of view since I only want to build a staticlib 04:47:56
@ahamon:matrix.orgAndy Hamonnot sure yet if it works with dependencies or not, crate has 0 deps. But I don't see why it wouldn't04:48:48
@ahamon:matrix.orgAndy Hamonalso no idea if my .a file even works04:48:57
@ahamon:matrix.orgAndy Hamon anyways, I wish crate2nix had better hooks for overriding aspects of the build en-mass. I already had to do something similar to add custom filtering to src. I just discovered a very long comment to myself explaining why its not as simple as it seems since we also want to propagate through invocations of override 05:06:30
@vhdirk:matrix.orgDirk Van Haerenborgh changed their display name from Dirk Van Haerenborgh @ FOSDEM to Dirk Van Haerenborgh.13:03:24
@rosssmyth:matrix.orgrosssmyth

Hello. How am I supposed to use makeRustPlatform? I have code like this:

      msrv_toolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
      rustPlatform = pkgs.makeRustPlatform {
        cargo = msrv_toolchain;
        rustc = msrv_toolchain;
      };
...
    mypackage = pkgs.callPackage mkThing { inherit rustPlatform };

and I am getting an error that says

  error: attribute 'buildPackage' missing
       at /nix/store/njnqqp2qgx2jfzk8jbfxghhm8x3gb4vl-source/flake.nix:37:7:
           36|     in
           37|       rustPlatform.buildPackage {

The package is just something like

    mkThing = {
      pkgs,
      rustPlatform,
      ...
    }:
      rustPlatform.buildPackage {
          ...
      }
15:38:38
@rosssmyth:matrix.orgrosssmyth *

Hello. How am I supposed to use makeRustPlatform? I have code like this:

      msrv_toolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
      rustPlatform = pkgs.makeRustPlatform {
        cargo = msrv_toolchain;
        rustc = msrv_toolchain;
      };
...
    mypackage = pkgs.callPackage mkThing { inherit rustPlatform };

and I am getting an error that says

  error: attribute 'buildPackage' missing
       at /nix/store/njnqqp2qgx2jfzk8jbfxghhm8x3gb4vl-source/flake.nix:37:7:
           36|     in
           37|       rustPlatform.buildPackage {

The package is just something like

    {
      pkgs,
      rustPlatform,
      ...
    }:
      rustPlatform.buildPackage {
          ...
      }
15:38:59
@rosssmyth:matrix.orgrosssmythAnd I can't use the debugger cause it just segfaults upon hitting any breakpoints 🥲15:40:45
@rosssmyth:matrix.orgrosssmythStupid mistake #2 this week. Ignore the above. 🥲19:00:52
12 Feb 2025
@maounomusume:matrix.orgmaounomusume joined the room.00:02:06
@glepage:matrix.orgGaétan Lepage Hey, I was not able to find how to specify build features when using Maturin.
I tried buildFeatures but it didn't propagate into maturin's flags.
08:58:02
@glepage:matrix.orgGaétan Lepage Seems like the best way is maturinBuildFlags. 09:45:14
@kira:jakira.spaceKira changed their display name from kira to Kira.19:59:40
@cleverca22:matrix.orgcleverca22 when using rustPlatform.buildRustPackage, is there a way to set the version in nix automatically from the cargo lock file? 20:36:07
@marcel:envs.net@marcel:envs.netDo you mean something like that? https://github.com/dd-ix/sflow_exporter/blob/main/package.nix#L820:36:39
@cleverca22:matrix.orgcleverca22ah, that looks good, let me try it20:37:06
@cleverca22:matrix.orgcleverca22
In reply to @marcel:envs.net
Do you mean something like that?
https://github.com/dd-ix/sflow_exporter/blob/main/package.nix#L8
yep, that works perfectly!
20:38:21
@cleverca22:matrix.orgcleverca22now to do the same thing on nodejs, thats far simpler, but also basically identical to the above!20:46:50
@cleverca22:matrix.orgcleverca22 manifest = pkgs.lib.importJSON ./package.json; and done! 20:48:54
13 Feb 2025
@sandro:supersandro.deSandro 🐧 Niklas Korz Alyssa Ross do you have any idea how I can myself bring the mitmproxy update forward? My rust compiler building skills are not enough to implement what you suggested above... 14:28:37
@qyliss:fairydust.spaceAlyssa RossThe issue still hasn't really been properly reported upstream14:31:36

Show newer messages


Back to Room ListRoom Version: 6