!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

586 Members
Rust129 Servers

Load older messages


SenderMessageTime
6 Jul 2025
@k900:0upti.meK900We don't really have good Windows support in nixpkgs15:18:59
@k900:0upti.meK900I am saying that nixpkgs, in its current state, can't save you15:19:09
@andrew15_5:matrix.orgAndrewSo you're telling there is a chance...15:19:22
@k900:0upti.meK900Maybe if someone puts in a good half a year of work and gets us a working MSVC toolchain15:19:24
@k900:0upti.meK900But you'd need to find someone with nixpkgs AND Windows expertise15:19:42
@k900:0upti.meK900And such people are extremely rare15:19:49
@k900:0upti.meK900If they even exist15:19:52
@andrew15_5:matrix.orgAndrewDo I understand correctly, that Windows platform support is not good, but Rust makes it even worse?15:20:20
@andrew15_5:matrix.orgAndrewBecause more variables etc.15:20:25
@k900:0upti.meK900No, Rust can actually make it OK-ish sometimes maybe15:20:37
@andrew15_5:matrix.orgAndrewBecause there are separate targets in Nixpkgs and separate ones in Rust.15:20:56
@k900:0upti.meK900But having native dependencies is what will generally get you15:21:01
@k900:0upti.meK900 That's how literally every compiler works 15:21:08
@andrew15_5:matrix.orgAndrewOkay, so I'll try installing the runtime first, and hope for the best. Otherwise... don't really wanna install Rust on that machine.15:21:57
@andrew15_5:matrix.orgAndrew* Okay, so I'll try installing the runtime first, and hope for the best. Otherwise... don't really wanna install Rust on that machine. Though maybe I will.15:22:25
@andrew15_5:matrix.orgAndrewThanks for the pointers.15:22:39
@k900:0upti.meK900You don't have to install Rust on the machines you're deploying to15:23:39
@k900:0upti.meK900You just need to install Rust (and MSVC++) on a single machine for the actual build15:23:49
@k900:0upti.meK900So yeah I can't find any specifics on Dioxus15:25:24
@k900:0upti.meK900But Tauri specifically says they only support MSVC ABI on Windows15:25:31
@k900:0upti.meK900And Dioxus uses Tauri for all the OS specific bits15:25:50
@k900:0upti.meK900So presumably they inherit that limitation15:25:58
@reflux1291:catgirl.cloudDerpy (they/any) changed their display name from Any (they/any) to Derpy (they/any).17:00:28
@cathal_mullan:matrix.orgCathal changed their display name from CJ to Cathal.17:17:37
@andrew15_5:matrix.orgAndrewI have a single machine.17:57:43
@andrew15_5:matrix.orgAndrew

I left this just in case:

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    rust-overlay.url = "github:oxalica/rust-overlay";
    rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = {
    nixpkgs,
    rust-overlay,
    ...
  } @ inputs: let
    system = "x86_64-linux";

    pkgs = import nixpkgs {
      inherit system;
      overlays = [inputs.rust-overlay.overlays.default];
    };
    inherit (pkgs) lib;
    pkgsWin = import nixpkgs {
      inherit system;
      crossSystem.config = "x86_64-w64-mingw32";
      overlays = [(import rust-overlay)];
    };

    rust-toolchain-linux = pkgs.rust-bin.stable.latest.default.override {
      extensions = ["rust-src" "rust-analyzer" "clippy"];
    };
    rust-toolchain-windows = pkgsWin.pkgsBuildHost.rust-bin.stable.latest.default.override {
      extensions = ["rust-src" "rust-analyzer" "clippy"];
      targets = ["x86_64-pc-windows-gnu"];
    };

    rustBuildInputs =
      [
        pkgs.openssl
        pkgs.libiconv
        pkgs.pkg-config
      ]
      ++ lib.optionals pkgs.stdenv.isLinux [
        pkgs.glib
        pkgs.gtk3
        pkgs.libsoup_3
        pkgs.webkitgtk_4_1
        pkgs.xdotool
      ]
      ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [
        IOKit
        Carbon
        WebKit
        Security
        Cocoa
      ]);
  in {
    devShells.${system} = {
      default = pkgs.mkShell {
        buildInputs = rustBuildInputs;
        nativeBuildInputs = [rust-toolchain-linux];
      };
      windows = pkgsWin.mkShell {
        # https://discourse.nixos.org/t/cross-compile-rust-for-windows/9582/10
        buildInputs = with pkgsWin; [openssl libiconv];
        # At least misses the Edge WebView2 Runtime (that can be bundled).
        nativeBuildInputs = [rust-toolchain-windows pkgs.wine64];
      };
    };
  };
}
17:57:57
@andrew15_5:matrix.orgAndrewApparently you can bundle the WebView2 Runtime with the app.17:58:21
@andrew15_5:matrix.orgAndrewMoreover, I succeeded and the binary actually produces (unarchives?) the WebView2 directory in the same PWD before the app can be run.17:59:27
@andrew15_5:matrix.orgAndrewapp.jpg
Download app.jpg
17:59:51
@andrew15_5:matrix.orgAndrewThough I need to ask Jon and Evan about this:18:00:07

Show newer messages


Back to Room ListRoom Version: 6