Skip to content

Blank window on nixos using Dioxus Native #5133

@Overloader6

Description

@Overloader6

Problem

When trying to run dx serve instead of a proper application I just see a blank window

Steps To Reproduce

Steps to reproduce the behavior:

  • Use nixos
  • Setup a dioxus project using the native target
  • Use a flake to set up dependencies:
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    rust-overlay = {
      url = "github:oxalica/rust-overlay";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs =
    {
      nixpkgs,
      rust-overlay,
      ...
    }:
    let
      system = "x86_64-linux";
      overlays = [ (import rust-overlay) ];
      pkgs = import nixpkgs {
        inherit system overlays;
      };
    in
    {
      devShells."${system}".default =
        pkgs.mkShell.override { stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv; }
          {
            packages = with pkgs; [
              (rust-bin.stable.latest.default.override {
                extensions = [
                  "rust-src"
                  "rust-analyzer"
                ];
              })
              dioxus-cli
              wasm-bindgen-cli
              cargo-nextest

              pkg-config
              openssl
              python3
            ];

            RUSTFLAGS =
              let
                dlopenLibraries = with pkgs; [
                  wayland
                  libxkbcommon
                  vulkan-loader
                ];
              in
              "-C link-arg=-Wl,-rpath,${pkgs.lib.makeLibraryPath dlopenLibraries}";
          };
    };
}

Expected behavior

A working window

Screenshots

Image

Environment:

  • Dioxus version: v0.7.2
  • Rust version: 1.92.0
  • OS info: NixOS Unstable
  • App platform: native

Questionnaire

I'm interested in fixing this myself but don't know where to start.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnativeRelated to dioxus-nativenixIssues related to nixos and the nix package manager

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions