Skip to content

fix(desktop): wrap with wrapGAppsHook3 so tray icon resolves on NixOS#3197

Merged
houko merged 4 commits into
mainfrom
fix/tray-icon-nixos-3192
Apr 26, 2026
Merged

fix(desktop): wrap with wrapGAppsHook3 so tray icon resolves on NixOS#3197
houko merged 4 commits into
mainfrom
fix/tray-icon-nixos-3192

Conversation

@houko
Copy link
Copy Markdown
Contributor

@houko houko commented Apr 26, 2026

Summary

  • Tray icon never appeared in librefang-desktop on NixOS, while the AppImage build worked on the same machine (Missing tray icon on NixOS #3192).
  • Root cause: tray-iconlibappindicator-sys 0.9.0 dlopens libayatana-appindicator3.so.1 at runtime with no DT_NEEDED entry. The previous fix (Librefang-desktop creates empty window (AppImage and NixOS) #3052) added the lib dir via patchelf --add-rpath, but modern patchelf writes DT_RUNPATH; glibc's ld.so only consults DT_RUNPATH for DT_NEEDED deps — never for dlopen() string-name lookups — so the RPATH was inert and the tray plugin silently failed to load.
  • Fix: switch the desktop derivation to wrapGAppsHook3 and inject pkgs.libayatana-appindicator on LD_LIBRARY_PATH via gappsWrapperArgs. As a bonus this also wires the GTK runtime env (XDG_DATA_DIRS, GIO_MODULE_DIR, GSETTINGS_SCHEMA_DIR) that the webview wants.

User confirmed in the issue that adding libayatana-appindicator to environment.systemPackages doesn't help — that's expected, NixOS has no global ld.so.conf, the dlopen simple-name lookup never sees system packages.
123

References

Test plan

  • nix build .#librefang-desktop succeeds on a Linux runner (CI).
  • On NixOS with the resulting build, launch librefang-desktop and verify the tray icon appears (right-click menu shows Show Window / Quit / etc).
  • Verify the wrapper exports the lib dir: cat $(nix path-info .#librefang-desktop)/bin/.librefang-desktop-wrapped should contain LD_LIBRARY_PATH=…libayatana-appindicator….
  • Verify CLI build still green: nix build .#librefang-cli (we did not touch that scope).
  • Smoke-test on a non-NixOS Linux distro (Ubuntu) to confirm wrapGAppsHook3 doesn't regress AppImage / cargo build paths.

Closes #3192

tray-icon -> libappindicator-sys dlopens libayatana-appindicator3.so.1
at runtime with no DT_NEEDED entry. The previous fix (#3052) added the
lib dir via `patchelf --add-rpath`, which writes DT_RUNPATH; glibc's
ld.so only consults DT_RUNPATH when resolving DT_NEEDED deps, never for
dlopen string-name lookups -- so the RPATH was inert and the tray icon
silently failed to appear on NixOS (#3192).

Switch the desktop derivation to wrapGAppsHook3 and inject the
libayatana-appindicator lib dir on LD_LIBRARY_PATH via
gappsWrapperArgs. As a bonus this also sets the GTK runtime env
(XDG_DATA_DIRS, GIO_MODULE_DIR, GSETTINGS_SCHEMA_DIR) the webview
expects.

Closes #3192
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions Bot added ready-for-review PR is ready for maintainer review size/S 10-49 lines changed labels Apr 26, 2026
The release pipeline currently ships platform bundles
(.AppImage/.deb/.dmg/.msi) but no `latest.json` updater manifest --
`tauri-action` silently skips manifest + signature generation when
`TAURI_SIGNING_PRIVATE_KEY` is unset. The plugin therefore emits
`ERROR tauri_plugin_updater::updater: update endpoint did not respond
with a successful status code` on every desktop startup, even though
nothing is broken on the user side.

Pre-flight the endpoint (HEAD with 5s timeout, URL read from the
plugin config so it stays in one place) before invoking
`updater.check()`. When the manifest is missing we log one INFO and
skip; when CI starts shipping `latest.json` the probe passes and the
plugin runs unmodified.
@github-actions github-actions Bot added size/M 50-249 lines changed and removed size/S 10-49 lines changed labels Apr 26, 2026
When a PR only touches crates that have zero tests (e.g.
librefang-desktop, which currently has none), the selective lane runs
`cargo nextest run -p librefang-desktop` and nextest exits with code 4
("no tests to run"), failing CI. nextest's default policy is fail-on-
empty; opting in to `--no-tests=pass` keeps the lane green when the
selected crates legitimately have nothing to run, without affecting the
full-workspace fallback.

Surfaced by PR #3197, which only touches flake.nix +
librefang-desktop/src/updater.rs and got blocked on Test/Ubuntu and
Test/macOS for this reason.
@github-actions github-actions Bot added the area/ci CI/CD and build tooling label Apr 26, 2026
@houko
Copy link
Copy Markdown
Contributor Author

houko commented Apr 26, 2026

@FrantaNautilus thanks for the report. Confirmed root cause + fix on a NixOS 25.11 / GNOME 49.2 box:

  • The previous patchelf --add-rpath in flake.nix wrote DT_RUNPATH, which ld.so only consults for DT_NEEDED deps, never for dlopen() string-name lookups. tray-iconlibappindicator-sys does pure runtime dlopen("libayatana-appindicator3.so.1") with no NEEDED entry, so the RPATH was inert. That's also why environment.systemPackages didn't help — NixOS has no /etc/ld.so.conf global cache.
  • This PR switches to wrapGAppsHook3 + gappsWrapperArgs to inject LD_LIBRARY_PATH. Verified end-to-end:
    • cat $out/bin/librefang-desktop shows --prefix LD_LIBRARY_PATH : '/nix/store/...-libayatana-appindicator-0.5.92/lib'
    • /proc/<pid>/maps of the running binary shows libayatana-appindicator3.so.1.0.0 and libdbusmenu actually mapped in.
    • GNOME shell receives the SNI item (saw Object Shell.TrayIcon events in journalctl --user).

One caveat I hit while testing — if the GNOME AppIndicator extension you use is v63 on GNOME 49, you'll see the icon flicker because of an upstream extension JS bug (Util.Logger.warning is not a function in trayIconsManager.js:93, GNOME 49 dropped that API). That's separate from this fix; the dlopen path is what the patch resolves. On 47/48 the same build should be fine.

Would appreciate it if you could rebuild from this branch on your NixOS box and confirm the icon shows up. Two extra commits in this PR (fb852858 desktop updater pre-flight, 31b6efd0 CI no-tests=pass) are unrelated noise that surfaced while validating — feel free to ignore those.

@github-actions github-actions Bot added needs-changes Changes requested by reviewer and removed ready-for-review PR is ready for maintainer review labels Apr 26, 2026
@houko houko merged commit ba686fd into main Apr 26, 2026
10 checks passed
@houko houko deleted the fix/tray-icon-nixos-3192 branch April 26, 2026 00:59
@github-actions github-actions Bot added ready-for-review PR is ready for maintainer review and removed needs-changes Changes requested by reviewer ready-for-review PR is ready for maintainer review labels Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci CI/CD and build tooling size/M 50-249 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing tray icon on NixOS

1 participant