I am trying to get up and running with the Dioxus tutorial. I am using NixOS.
This is my shell file. I copied the shell.nix file from the Tauri docs, which is recommended by Dioxus, and then I added the nix package for the dioxus-cli and wasm-pack.
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/fa35a3c8e17a3de613240fea68f876e5b4896aec.tar.gz";
pkgs = import nixpkgs {
config = { };
overlays = [];
};
in
pkgs.mkShell {
buildInputs = with pkgs;[
at-spi2-atk
atkmm
cairo
gdk-pixbuf
glib
gtk3
harfbuzz
librsvg
libsoup_3
pango
webkitgtk_4_1
openssl
];
nativeBuildInputs = with pkgs; [
pkg-config
gobject-introspection
cargo
cargo-tauri
nodejs
];
packages = with pkgs; [
dioxus-cli
emacs
git
wasm-pack
];
RUST_BACKTRACE = 1;
RUSTFLAGS = "-Awarnings";
}
Then, per the Dioxus tutorial, I created a project using dx new hot_dog and declined the fullstack website, the router, and Tailwind, and I set the default platform to Web.
When I run cargo build it builds just fine, but when I run `dx build, I get an error. This is the full stack trace:
[nix-shell:~/workbench/hot_dog]$ dx build
0. 0s INFO Building project...
0.243s ERROR Failed to verify tooling: I/O Error: No such file or directory (os error 2)
dx will proceed, but you might run into errors later.
0.321s ERROR Cargo build failed - no output location
0.332s ERROR err=Other(Build did not return an executable
Stack backtrace:
0: dx::build::request::BuildRequest::build_app::{{closure}}
1: <futures_util::future::try_maybe_done::TryMaybeDone<Fut> as core::future::future::Future>::poll
2: <futures_util::future::try_join::TryJoin<Fut1,Fut2> as core::future::future::Future>::poll
3: dx::build::request::BuildRequest::build_all::{{closure}}
4: dx::build::builder::Builder::start::{{closure}}
5: tokio::runtime::task::core::Core<T,S>::poll
6: tokio::runtime::task::harness::Harness<T,S>::poll
7: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
8: tokio::runtime::scheduler::multi_thread::worker::Context::run
9: tokio::runtime::context::scoped::Scoped<T>::set
10: tokio::runtime::context::runtime::enter_runtime
11: tokio::runtime::scheduler::multi_thread::worker::run
12: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
13: tokio::runtime::task::core::Core<T,S>::poll
14: tokio::runtime::task::harness::Harness<T,S>::poll
15: tokio::runtime::blocking::pool::Inner::run
16: std::sys::backtrace::__rust_begin_short_backtrace
17: core::ops::function::FnOnce::call_once{{vtable.shim}}
18: std::sys::pal::unix::thread::Thread::new::thread_start
19: start_thread
20: __GI___clone3)
0.333s ERROR err=Other(Build did not return an executable
Stack backtrace:
0: dx::build::request::BuildRequest::build_app::{{closure}}
1: <futures_util::future::try_maybe_done::TryMaybeDone<Fut> as core::future::future::Future>::poll
2: <futures_util::future::try_join::TryJoin<Fut1,Fut2> as core::future::future::Future>::poll
3: dx::build::request::BuildRequest::build_all::{{closure}}
4: dx::build::builder::Builder::start::{{closure}}
5: tokio::runtime::task::core::Core<T,S>::poll
6: tokio::runtime::task::harness::Harness<T,S>::poll
7: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
8: tokio::runtime::scheduler::multi_thread::worker::Context::run
9: tokio::runtime::context::scoped::Scoped<T>::set
10: tokio::runtime::context::runtime::enter_runtime
11: tokio::runtime::scheduler::multi_thread::worker::run
12: <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll
13: tokio::runtime::task::core::Core<T,S>::poll
14: tokio::runtime::task::harness::Harness<T,S>::poll
15: tokio::runtime::blocking::pool::Inner::run
16: std::sys::backtrace::__rust_begin_short_backtrace
17: core::ops::function::FnOnce::call_once{{vtable.shim}}
18: std::sys::pal::unix::thread::Thread::new::thread_start
19: start_thread
20: __GI___clone3)
[nix-shell:~/workbench/hot_dog]$
This error seems very opaque to me as a newcomer to dioxus and a Nix beginner. Any ideas for a nix-shell that's able to successfully build this project?
this flake works for dioxus dev (at least for the tutorial)
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default";
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems;
perSystem =
{
pkgs,
...
}:
let
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
rust-toolchain = pkgs.symlinkJoin {
name = "rust-toolchain";
paths = with pkgs; [
rustc
cargo
cargo-watch
rust-analyzer
rustPlatform.rustcSrc
cargo-dist
cargo-tarpaulin
cargo-insta
cargo-machete
cargo-edit
];
};
buildInputs = with pkgs; [
at-spi2-atk
atkmm
cairo
gdk-pixbuf
glib
gtk3
harfbuzz
librsvg
libsoup_3
pango
webkitgtk_4_1
openssl
wasm-bindgen-cli
lld_20
];
nativeBuildInputs = with pkgs; [
pkg-config
gobject-introspection
cargo
cargo-tauri
nodejs
];
in
{
# Rust package
packages.default = pkgs.rustPlatform.buildRustPackage {
inherit (cargoToml.package) name version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
RUST_BACKTRACE = "full";
nativeBuildInputs = nativeBuildInputs;
buildInputs = buildInputs;
};
# Rust dev environment
devShells.default = pkgs.mkShell {
RUST_BACKTRACE = "full";
RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
packages =
nativeBuildInputs
++ buildInputs
++ [
rust-toolchain
]
++ (with pkgs; [
clippy
dioxus-cli
]);
};
};
};
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With