!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

658 Members
Rust148 Servers

Load older messages


SenderMessageTime
5 Jan 2026
@theo-paris:matrix.orgTheo ParisAlternatively I could use rustup but I'd like to get nixpkgs cross working03:21:11
@theo-paris:matrix.orgTheo Paris* Alternatively I could use rustup but I'd like to get nixpkgs cross compilation working03:21:25
@goodtab:matrix.orggoodtab joined the room.08:22:22
@frederic:scs.ems.hostFrédéric Christ changed their display name from Frédéric Christ (back on 02.01.) to Frédéric Christ.09:38:37
@epiceric:nixos.devEpic Eric changed their display name from Eric Pires to Epic Eric.09:39:12
@niklaskorz:matrix.orgniklaskorzwe have the wasm targets as part of the normal rust toolchain, so you don't necessarily need pkgsCross12:20:01
@niklaskorz:matrix.orgniklaskorzi.e. you can target wasm32-unknown-none from any system's pkgs.rustc12:20:15
@robin:icewind.nl@robin:icewind.nl left the room.14:12:04
6 Jan 2026
@eyduh:matrix.orgeyduh (she/they) changed their profile picture.18:20:52
@eyduh:matrix.orgeyduh (she/they) changed their profile picture.18:25:31
7 Jan 2026
@accelbread:matrix.orgaccelbread joined the room.04:26:13
@accelbread:matrix.orgaccelbreadDoes anybody know how to get miri with nixpkgs rustc? do I just override configureFlags?04:27:11
@epiceric:nixos.devEpic EricRedacted or Malformed Event10:33:54
@epiceric:nixos.devEpic EricMaybe via pkgs.rustup? cargo-miri seems to be part of it10:50:58
@accelbread:matrix.orgaccelbreaddidn't want to use rustup, though I got it working with some messy buildRustPackage10:51:35
@epiceric:nixos.devEpic EricIt might be worth making a Nix package for it10:52:33
@accelbread:matrix.orgaccelbreadThat would be useful, yeah Though idk if what I ended up with would be usable in nixpkgs: https://codeberg.org/accelbread/basis-rs/commit/7a9c1b4fb9a269a2c0f819d892c932e93dd97250 install phase was broken with sourceRoot set since it expected to be in same dir as target though target got created at root of unpacked source, not sourceRoot. And cargoRoot didnt work; got some weird errors about incorrect hashes when using it10:55:53
@accelbread:matrix.orgaccelbreadhmm actually might be simpler to use rustc.src's vendor dir if that has everything miri/cargo-miri needs...11:06:52
@emilazy:matrix.orgemilydoesn't Miri require nightly?14:46:48
@emilazy:matrix.orgemilyhave you considered rust-overlay?14:47:26
@emilazy:matrix.orgemilyyou can get the Nightly binaries packaged in Nix that way14:47:40
@accelbread:matrix.orgaccelbread yeah, those are binary builds though. And I don't want another flake dependency.
I built it with nix rustc with RUSTC_BOOTSTRAP=1, to enable unstable features
22:09:12
8 Jan 2026
@epiceric:nixos.devEpic EricDoes anybody by some chance have a dev environment for working with godot-rust?00:23:31
@epiceric:nixos.devEpic Eric

Far from the best but at least I managed to do what I wanted to do with this dirty shell

let
  sources = import ./npins;
  pkgs = import sources.nixpkgs {
    overlays = [ (import sources.rust-overlay) ];
  };

  pkgs-cross-mingw = import pkgs.path {
    crossSystem = {
      config = "x86_64-w64-mingw32";
    };
  };

  mingw_w64_cc = pkgs-cross-mingw.stdenv.cc;
  mingw_w64 = pkgs-cross-mingw.windows.mingw_w64;
  mingw_w64_pthreads_w_static = pkgs-cross-mingw.windows.pthreads.overrideAttrs (oldAttrs: {
    configureFlags = (oldAttrs.configureFlags or [ ]) ++ [
      "--enable-static"
    ];
  });
in
pkgs.mkShell {
  packages = [
    pkgs.bacon
    pkgs.godot_4_5
    pkgs.godot_4_5-export-templates-bin
    mingw_w64_cc
    (pkgs.rust-bin.stable.latest.default.override {
      targets = [ "x86_64-pc-windows-gnu" ];
    })
    pkgs.wineWowPackages.stable
  ];

  WINDOWS_RUSTFLAGS = (
    map (a: ''-L ${a}/lib'') [
      mingw_w64
      mingw_w64_pthreads_w_static
    ]
  );
}
02:00:01
@yawd:matrix.orgDiego Reis joined the room.02:58:44
@epiceric:nixos.devEpic Eric

For the record, this is my (somewhat) cleaner build derivation (still need to add Linux building and separate the build phase into two)

let
  sources = import ./npins;
  pkgs = import sources.nixpkgs {
    overlays = [ (import sources.rust-overlay) ];
  };

  inherit (pkgs) lib stdenv;

  pkgs-cross-mingw = import pkgs.path {
    crossSystem = {
      config = "x86_64-w64-mingw32";
    };
  };

  mingw_w64_cc = pkgs-cross-mingw.stdenv.cc;
  mingw_w64 = pkgs-cross-mingw.windows.mingw_w64;
  mingw_w64_pthreads_w_static = pkgs-cross-mingw.windows.pthreads.overrideAttrs (oldAttrs: {
    configureFlags = (oldAttrs.configureFlags or [ ]) ++ [
      "--enable-static"
    ];
  });

  rust = pkgs.rust-bin.stable.latest.default;

  rustCc = pkgs.rust-bin.stable.latest.default.override {
    targets = [ "x86_64-pc-windows-gnu" ];
  };

  src = lib.fileset.toSource {
    root = ./.;
    fileset = lib.fileset.unions [
      ./godot
      ./rust
    ];
  };

  commonArgs = {
    version = "0";
    inherit src;
    cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
      inherit src;
      sourceRoot = "${src.name}/rust";
      hash = "sha256-kRZdndknulrZFeb7EDwNrpctjaT/UreFwZREOxv7e08=";
    };
    cargoRoot = "rust";
    postPatch = ''
      export HOME=$(mktemp -d)
      mkdir -p ~/.local/share/godot
      ln -s ${pkgs.godot_4_5-export-templates-bin}/share/godot/export_templates ~/.local/share/godot/export_templates
    '';
  };

  commonArgsWin = commonArgs // {
    RUSTFLAGS = (
      map (a: ''-L ${a}/lib'') [
        mingw_w64
        mingw_w64_pthreads_w_static
      ]
    );
    buildInputs = [
      pkgs.rustPlatform.cargoSetupHook
      mingw_w64_cc
      rustCc
    ];
  };
in
{
  windows-release = stdenv.mkDerivation (
    commonArgsWin
    // {
      pname = "crane-game-windows-release";
      buildPhase = ''
        ${rustCc}/bin/cargo build --target x86_64-pc-windows-gnu --release --manifest-path ./rust/Cargo.toml
        mkdir ./export_windows
        ${pkgs.godot_4_5}/bin/godot --headless --path ./godot --export-release "Windows Desktop" ../export_windows/CraneGame_win.exe
      '';

      installPhase = ''
        mkdir $out
        cp ./export_windows/* $out
      '';
    }
  );
}
12:43:23
@drupol:matrix.orgPolI always forgot about the Nix Rust room! 13:08:59
@drupol:matrix.orgPolI posted this (https://gist.github.com/drupol/41bef4037d1d4c116f5ffa6df6493e28) in the main Nix room, but I guess I should have posted it here.13:09:20
@drupol:matrix.orgPol I'm trying to understand why overriding oldAttr.cargoDeps does not work. Can you help ? 13:09:45
@wilhelmines:matrix.orgwilhelmines joined the room.16:55:35

There are no newer messages yet.


Back to Room ListRoom Version: 6