Repository: tauri
Issue: [bug] pkg-config can't find libsoup via nix
Labels: type: bug,platform: Linux,status: needs triage,platform: Nix/NixOS

### Describe the bug

Building fails:

```
pnpm tauri build

> terratestlogviewerv3@0.1.0 tauri /home/salmon/git/TerratestLogViewerV3
> tauri "build"

    Running beforeBuildCommand `pnpm build`

> terratestlogviewerv3@0.1.0 build /home/salmon/git/TerratestLogViewerV3
> vite build

vite v5.4.8 building SSR bundle for production...
✓ 94 modules transformed.
vite v5.4.8 building for production...
✓ 67 modules transformed.
.svelte-kit/output/client/_app/version.json                             0.03 kB │ gzip:  0.05 kB
.svelte-kit/output/client/.vite/manifest.json                           2.57 kB │ gzip:  0.52 kB
.svelte-kit/output/client/_app/immutable/assets/2.Cl62EbOl.css          1.69 kB │ gzip:  0.68 kB
.svelte-kit/output/client/_app/immutable/entry/start.CBs8aynU.js        0.07 kB │ gzip:  0.08 kB
.svelte-kit/output/client/_app/immutable/nodes/0.tabcKxng.js            0.74 kB │ gzip:  0.48 kB
.svelte-kit/output/client/_app/immutable/nodes/1.0WP_iUaH.js            1.02 kB │ gzip:  0.59 kB
.svelte-kit/output/client/_app/immutable/chunks/scheduler.BvLojk_z.js   2.16 kB │ gzip:  1.02 kB
.svelte-kit/output/client/_app/immutable/nodes/2.BPurbqBj.js            2.47 kB │ gzip:  1.18 kB
.svelte-kit/output/client/_app/immutable/chunks/index.BKQmPpam.js       5.64 kB │ gzip:  2.39 kB
.svelte-kit/output/client/_app/immutable/entry/app.c75_ySdt.js          6.13 kB │ gzip:  2.52 kB
.svelte-kit/output/client/_app/immutable/chunks/entry.Bzp4lb2o.js      28.41 kB │ gzip: 11.21 kB
✓ built in 176ms
.svelte-kit/output/server/.vite/manifest.json                         2.67 kB
.svelte-kit/output/server/_app/immutable/assets/_page.Cl62EbOl.css    1.69 kB
.svelte-kit/output/server/entries/pages/_layout.ts.js                 0.07 kB
.svelte-kit/output/server/entries/fallbacks/layout.svelte.js          0.24 kB
.svelte-kit/output/server/internal.js                                 0.31 kB
.svelte-kit/output/server/entries/fallbacks/error.svelte.js           1.16 kB
.svelte-kit/output/server/chunks/ssr.js                               3.49 kB
.svelte-kit/output/server/chunks/exports.js                           5.94 kB
.svelte-kit/output/server/chunks/internal.js                          6.07 kB
.svelte-kit/output/server/entries/pages/_page.svelte.js               8.06 kB
.svelte-kit/output/server/index.js                                  118.32 kB
✓ built in 874ms

Run npm run preview to preview your production build locally.

> Using @sveltejs/adapter-static
  Wrote site to "build"
  ✔ done
   Compiling openssl-sys v0.9.103
   Compiling glib-sys v0.18.1
   Compiling gobject-sys v0.18.0
   Compiling gio-sys v0.18.1
   Compiling gdk-sys v0.18.0
   Compiling cairo-sys-rs v0.18.2
   Compiling gdk-pixbuf-sys v0.18.0
   Compiling pango-sys v0.18.0
   Compiling atk-sys v0.18.0
   Compiling javascriptcore-rs-sys v1.1.1
   Compiling soup3-sys v0.5.0
   Compiling x11-dl v2.21.0
   Compiling tauri-plugin-shell v2.0.1
   Compiling terratestlogviewerv3 v0.1.0 (/home/salmon/git/TerratestLogViewerV3/src-tauri)
   Compiling gtk-sys v0.18.0
   Compiling gdkx11-sys v0.18.0
The following warnings were emitted during compilation:

warning: soup3-sys@0.5.0: 

error: failed to run custom build command for `soup3-sys v0.5.0`

Caused by:
  process didn't exit successfully: `/home/salmon/git/TerratestLogViewerV3/src-tauri/target/release/build/soup3-sys-8b282c1a5ed45d66/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=LIBSOUP_3.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=
  pkg-config exited with status code 1
  > PKG_CONFIG_PATH=/home/salmon/.gvm/pkgsets/go1.22.1/global/overlay/lib/pkgconfig:/nix/store/6r6rzv2v3x8mh2ki391gvc9y9954yzlg-glib-2.80.4-dev/lib/pkgconfig:/nix/store/4paq4ph6r3jaas7rqy2iprk6dgvjh9mr-libsoup-3.4.4-dev/lib/pkgconfig:/nix/store/kpz0hy3c1pcmk76rimfz04mywzrymc0v-webkitgtk-2.46.0+abi=4.1-dev/lib/pkgconfig:/nix/store/l7zwbxzhabcrszp4f9kjvax9fy18mnba-at-spi2-core-2.52.0-dev/lib/pkgconfig:/nix/store/a9af132rd3pz7nzvb7znybgcw1vjwm0r-gtk+3-3.24.43-dev/lib/pkgconfig:/nix/store/samvjksx5s1fpfjxpb9c3c19zs7nr8r3-gdk-pixbuf-2.42.12-dev/lib/pkgconfig:/nix/store/kar6nif5yf3hb0s8dlyhlgrcm2zqg5bs-cairo-1.18.0-dev/lib/pkgconfig:/nix/store/l6kp2q6011lshqrj1jrin5kvkbjsng5c-pango-1.52.2-dev/lib/pkgconfig:/nix/store/ww1bzzir84hjvjdzgv374qj1yalh90qn-harfbuzz-9.0.0-dev/lib/pkgconfig:/nix/store/yamw9igrv93n5dhmlfhpkh03v6y620y1-librsvg-2.58.2-dev/lib/pkgconfig PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags libsoup-3.0 libsoup-3.0 >= 3.0

  The system library `libsoup-3.0` required by crate `soup3-sys` was not found.
  The file `libsoup-3.0.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  PKG_CONFIG_PATH contains the following:
      - /home/salmon/.gvm/pkgsets/go1.22.1/global/overlay/lib/pkgconfig
      - /nix/store/6r6rzv2v3x8mh2ki391gvc9y9954yzlg-glib-2.80.4-dev/lib/pkgconfig
      - /nix/store/4paq4ph6r3jaas7rqy2iprk6dgvjh9mr-libsoup-3.4.4-dev/lib/pkgconfig
      - /nix/store/kpz0hy3c1pcmk76rimfz04mywzrymc0v-webkitgtk-2.46.0+abi=4.1-dev/lib/pkgconfig
      - /nix/store/l7zwbxzhabcrszp4f9kjvax9fy18mnba-at-spi2-core-2.52.0-dev/lib/pkgconfig
      - /nix/store/a9af132rd3pz7nzvb7znybgcw1vjwm0r-gtk+3-3.24.43-dev/lib/pkgconfig
      - /nix/store/samvjksx5s1fpfjxpb9c3c19zs7nr8r3-gdk-pixbuf-2.42.12-dev/lib/pkgconfig
      - /nix/store/kar6nif5yf3hb0s8dlyhlgrcm2zqg5bs-cairo-1.18.0-dev/lib/pkgconfig
      - /nix/store/l6kp2q6011lshqrj1jrin5kvkbjsng5c-pango-1.52.2-dev/lib/pkgconfig
      - /nix/store/ww1bzzir84hjvjdzgv374qj1yalh90qn-harfbuzz-9.0.0-dev/lib/pkgconfig
      - /nix/store/yamw9igrv93n5dhmlfhpkh03v6y620y1-librsvg-2.58.2-dev/lib/pkgconfig

  HINT: you may need to install a package such as libsoup-3.0, libsoup-3.0-dev or libsoup-3.0-devel.

warning: build failed, waiting for other jobs to finish...
failed to build app: failed to build app
    Error failed to build app: failed to build app
 ELIFECYCLE  Command failed with exit code 1.
```

The build failed because `libsoup-3.0.pc` was not found. However, we can see that `/nix/store/4paq4ph6r3jaas7rqy2iprk6dgvjh9mr-libsoup-3.4.4-dev/lib/pkgconfig` is in `PKG_CONFIG_PATH`. Looking in that directory, we can see `libsoup-3.0.pc` is actually available:
```
ls -lsh /nix/store/4paq4ph6r3jaas7rqy2iprk6dgvjh9mr-libsoup-3.4.4-dev/lib/pkgconfig                                                                                          
total 4.0K
4.0K -r--r--r-- 2 root root 516 Dec 31  1969 libsoup-3.0.pc
```

It is also worth noting that `pnpm tauri dev` runs without errors.

This problem might be related to #11077, which seems like a similar issue but with a different dependency.

### Reproduction

Make a new project `cargo create-tauri-app`.

Create `flake.nix`:

```nix
{
  description = "build and development environment";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    rust-overlay = {
      url = "github:oxalica/rust-overlay";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        flake-utils.follows = "flake-utils";
      };
    };
  };

  outputs = {
    self,
    nixpkgs,
    flake-utils,
    rust-overlay,
    ...
  }:
    flake-utils.lib.eachDefaultSystem (system: let
      overlays = [
        (import rust-overlay)
      ];

      pkgs = import nixpkgs {inherit overlays system;};

      rustVersion = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain;
      rust-toolchain = rustVersion.override {
        extensions = ["rust-analyzer" "rust-src"];
      };
    in
      with pkgs; rec {
        devShells.default = mkShell {
          packages = [
            alejandra
            nodejs_22
            pnpm
            rust-toolchain

            # tauri build deps
            openssl
            at-spi2-atk
            atkmm
            cairo
            gdk-pixbuf
            glib
            gobject-introspection
            gobject-introspection.dev
            gtk3
            harfbuzz
            librsvg
            libsoup_3
            pango
            webkitgtk_4_1
            webkitgtk_4_1.dev
          ];

          PKG_CONFIG_PATH = "${glib.dev}/lib/pkgconfig:${libsoup_3.dev}/lib/pkgconfig:${webkitgtk_4_1.dev}/lib/pkgconfig:${at-spi2-atk.dev}/lib/pkgconfig:${gtk3.dev}/lib/pkgconfig:${gdk-pixbuf.dev}/lib/pkgconfig:${cairo.dev}/lib/pkgconfig:${pango.dev}/lib/pkgconfig:${harfbuzz.dev}/lib/pkgconfig:${pkgs.librsvg.dev}/lib/pkgconfig";
        };

        formatter = alejandra;
      });
}
```

Run `nix develop` and `pnpm tauri build`.

### Expected behavior

The libsoup dependency is present, so I expect the build to complete without errors.

### Full `tauri info` output

```text
[✔] Environment
    - OS: Ubuntu 24.4.0 x86_64 (X64)
    ✔ webkit2gtk-4.1: 2.46.0
    ✔ rsvg2: 2.58.2
    ✔ rustc: 1.81.0 (eeb90cda1 2024-09-04)
    ✔ cargo: 1.81.0 (2dbb1af80 2024-08-20)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (overridden by '/home/salmon/git/TerratestLogViewerV3/rust-toolchain')
    - node: 22.8.0
    - pnpm: 9.10.0
    - npm: 10.8.2

[-] Packages
    - tauri 🦀: 2.0.1
    - tauri-build 🦀: 2.0.1
    - wry 🦀: 0.44.1
    - tao 🦀: 0.30.3
    - @tauri-apps/api : 2.0.1
    - @tauri-apps/cli : 2.0.1

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.1
    - @tauri-apps/plugin-shell : 2.0.0

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:1420/
    - framework: Svelte
    - bundler: Vite
```


### Stack trace

_No response_

### Additional context

This is built inside WSL2 running Ubuntu 24.04.1 LTS (5.15.153.1-microsoft-standard-WSL2).