NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.46k stars 12.95k forks source link

cargo-tauri package can not be used to build appimages for tauri apps #295720

Open yeus opened 3 months ago

yeus commented 3 months ago

Describe the bug

cargo-tauri app can not be used to build appimage for tauri apps

Here are more explanations: https://github.com/tauri-apps/tauri/issues/8535

Steps To Reproduce

Steps to reproduce the behavior:

  1. use the provided flake:
  2. create a tauri app
  3. https://github.com/tauri-apps/tauri/issues/8535
  4. run tauri build -v

results in:

-- Running input plugin: gtk --
[gtk/stdout] Installing AppRun hook
[gtk/stderr] chmod: cannot access 'taskyon.AppDir/usr/lib64': No such file or directory
[gtk/stdout] Installing GLib schemas
[gtk/stderr] Package gio-2.0 was not found in the pkg-config search path.
[gtk/stderr] Perhaps you should add the directory containing `gio-2.0.pc'
[gtk/stderr] to the PKG_CONFIG_PATH environment variable
[gtk/stderr] No package 'gio-2.0' found
[gtk/stderr] cp: cannot stat '/usr/share/glib-2.0/schemas': No such file or directory

Expected behavior

It should work out-of-the-box

Screenshots

https://github.com/tauri-apps/tauri/issues/8535

Notify maintainers

@dit7ya @happysalada

Context

  description = "Nix Development Flake for Taskyon";

  inputs = {
    flake-utils.url = "github:numtide/flake-utils";
    #nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
  };

  outputs = { self, nixpkgs, flake-utils }:

    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs { inherit system; };

        libraries = with pkgs; [
          cargo-tauri
        ];
        packages = with pkgs; [
          curl
          wget
          pkg-config

          # node
          yarn
          nodejs_21
        ];
      in {
        devShells.default = pkgs.mkShell rec {
          name = "xyntopia_gui";
          buildInputs = libraries ++ packages;
          shellHook = ''
            export PATH="$(pwd)/node_modules/.bin:$PATH"

            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
          '';
        };
      });
}

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

❯ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.81, NixOS, 23.11 (Tapir), 23.11.20240312.51063ed`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a :+1: reaction to issues you find important.

happysalada commented 3 months ago

Hey thanks for reporting. Im wondering what we are doing wrong exactky. It could be just an env var that needs to be set or something. If you hear from upstream im interested!

yeus commented 4 weeks ago

hey, I have investigated a little further.

it seems that the missing https://nixos.wiki/wiki/Rust#Installation_via_rustup is part of the glib.dev package.

--> nix-locate --top-level /share/glib-2.0/schemas

--> I found this version here, configuring rust with rustup:

https://nixos.wiki/wiki/Rust#Installation_via_rustup

it sets some env variables and installes gib.dev. I tried several things with that, but still the same error.