tauri: [bug] AppImage build fail with Nix Flake
Describe the bug
Hello,
I’m on Ubuntu 22.04 but using Nix package manager.
After following your prerequisites for NixOS and attempting to build a tauri project with the below flake.nix, I got the following error:
-- Running input plugin: gtk --
[gtk/stderr] chmod: cannot access 'edgen-chat.AppDir/usr/lib64': No such file or directory
[gtk/stdout] Installing AppRun hook
[gtk/stderr] cp: cannot stat '/nix/store/2if9iy5cy0bicwafllpa2aiq30v26app-glib-2.78.1/share/glib-2.0/schemas': No such file or directory
[gtk/stdout] Installing GLib schemas
ERROR: Failed to run plugin: gtk (exit code: 1)
Error [tauri_cli_node] failed to bundle project: error running appimage.sh
error Command failed with exit code 1.
Thanks in advance
Reproduction
flake.nix:
{
inputs = {
nixpkgs.url = "nixpkgs";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
rust-toolchain = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
extensions = [ "rust-src" ];
#targets = [ "wasm32-unknown-unknown" ];
});
nativeBuildInputs = with pkgs; [
pkg-config
rust-toolchain
];
libraries = with pkgs;[
webkitgtk
gtk3
cairo
gdk-pixbuf
glib
dbus
openssl_3
librsvg
];
packages = with pkgs; [
curl
wget
dbus
openssl_3
glib
gtk3
gdk-pixbuf
libsoup
pango
harfbuzz
at-spi2-atk
cairo
webkitgtk
librsvg
yarn
nodejs_18
];
buildInputs = packages;
in
rec {
# `nix develop`
devShell = pkgs.mkShell {
inherit buildInputs nativeBuildInputs;
shellHook = ''
# For rust-analyzer 'hover' tooltips to work.
export RUST_SRC_PATH=${rust-toolchain}
# add ~/.cargo/bin to PATH for crates installed with `cargo install`
export PATH=$PATH:$HOME/.cargo/bin
export RUST_BACKTRACE=1
# tauri
export WEBKIT_DISABLE_COMPOSITING_MODE=1
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath libraries}:$LD_LIBRARY_PATH
export XDG_DATA_DIRS=${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS
'';
};
});
}
Expected behavior
Successful build with no issues.
Full tauri info output
[⚠] Environment
- OS: Ubuntu 22.04 X64
✔ webkit2gtk-4.0: 2.42.3
✔ rsvg2: 2.57.0
✔ rustc: 1.77.0-nightly (3d0e6bed6 2023-12-21)
✔ cargo: 1.77.0-nightly (1a2666ddd 2023-12-17)
⚠ rustup: not installed!
If you have rust installed some other way, we recommend uninstalling it
then use rustup instead. Visit https://rustup.rs/
⚠ Rust toolchain: couldn't be detected!
Maybe you don't have rustup installed? if so, Visit https://rustup.rs/
- node: 18.19.0
- yarn: 1.22.19
- npm: 10.2.3
[-] Packages
- tauri [RUST]: 1.5.4
- tauri-build [RUST]: 1.5.1
- wry [RUST]: 0.24.7
- tao [RUST]: 0.16.5
- tauri-cli [RUST]: 1.5.9
- @tauri-apps/api : not installed!
- @tauri-apps/cli [NPM]: 1.5.9
[-] App
- build-type: bundle
- CSP: unset
- distDir: ../out
- devPath: http://localhost:3000/
- framework: React (Next.js)
- bundler: Webpack
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 6
- Comments: 28 (1 by maintainers)
Commits related to this issue
- feat(infra): desktop aio build workflow This PR adds an actions workflow pipeline for building and packaging the self-hosted Hoppscotch Desktop app across different platforms. Platform supported rig... — committed to hoppscotch/hoppscotch by CuriousCorrelation 2 years ago
- feat(infra): desktop aio build workflow This PR adds an actions workflow pipeline for building and packaging the self-hosted Hoppscotch Desktop app across different platforms. Platform supported rig... — committed to hoppscotch/hoppscotch by CuriousCorrelation 2 years ago
- feat(infra): desktop aio build workflow pipeline (#5005) * feat(infra): desktop aio build workflow This PR adds an actions workflow pipeline for building and packaging the self-hosted Hoppscotch Des... — committed to hoppscotch/hoppscotch by CuriousCorrelation 2 years ago
Hey so me and @getchoo have been working a hook that might fix this.
The above PR has been merged. Tauri packages can now be built in nixpkgs via
cargo-tauri.hook, which is documented here – many real world examples can also be searched through hereMention PR: https://github.com/NixOS/nixpkgs/pull/335751
seeing same here https://github.com/rainlanguage/rain.orderbook/actions/runs/7479976179/job/20358351394?pr=57
note though that this is just ubuntu with nix not nixos
There is a pr that’s in progress of updating tauri here: https://github.com/NixOS/nixpkgs/pull/346277
Hi, I believe I have located something that might be causing this. I was trying to build https://github.com/Martichou/rquickshare, and was running into this error. If you run
pnpm build --verbose, you get the following error:This looks a lot like the output of
pkg-config ayatana-appindicator3-0.1 --libs-only-L, but without the leading-Lflag in the first input, leading me to think that there was an assumption thatpkg-configwould only ever output one value for the path of a library. Following the breadcrumbs in the code:This is copy command causing the bug. This reads from an environment variable
TAURI_TRAY_LIBRARY_PATH. This is set here. The code that setspath(which the env var is set to) always leads to calling [this function]((https://github.com/tauri-apps/tauri/blob/16641723b001b1172d1962e9fa80f5fafbc570f0/tooling/cli/src/interface/rust.rs#L1442), which, as written in the comment, and as evident in the linedoes in fact make that assumption that pkg-config only outputs one library, which it does not do on nixos.
I’m not sure how this might need to be fixed, but given that this can happen on any system where there are multiple versions of a package, this should probably be fixed here as opposed to being simply patched in nixpkgs.