From 72fe28f3f2cba3efe11e7be23bfa393277a0f5f6 Mon Sep 17 00:00:00 2001 From: Charley Date: Thu, 16 Apr 2026 18:40:06 -0400 Subject: [PATCH] fix(flake): make NixOS build work end-to-end MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Four issues prevented a clean nixos-rebuild on NixOS 26.05+ unstable: 1. perl/clang/pkg-config were in buildInputs but openssl-src's build.rs needs them on PATH at compile time → move to nativeBuildInputs. 2. openfang-desktop's GTK app needs wrapGAppsHook3 (renamed from wrapGAppsHook in current nixpkgs) and pkg-config in nativeBuildInputs to discover webkitgtk_4_1.pc and properly wrap runtime env vars. 3. libayatana-appindicator added to desktop buildInputs so the closure includes it. Without it, libappindicator-sys's runtime dlopen fails with 'cannot open shared object file' and the desktop binary panics at tray initialization. 4. preFixup hook injects libayatana-appindicator's lib path into gappsWrapperArgs. Required because the lib is dlopen'd at runtime (no link-time dep), so 'just adding to buildInputs' isn't enough — Nix's reference scanner only sees deps that appear in the binary. The string interpolation forces inclusion in the closure AND wraps LD_LIBRARY_PATH for the dlopen call to succeed. Tested on NixOS 26.05 (nixos-unstable channel) with AMD RX 7900 XTX, Hyprland 0.53+, webkitgtk_4_1, gtk3. Desktop window renders cleanly without any WEBKIT_* fallback env vars. --- flake.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/flake.nix b/flake.nix index 999cc5c66a..1600ae943c 100644 --- a/flake.nix +++ b/flake.nix @@ -22,20 +22,35 @@ ... }: { rust-project.src = lib.sources.cleanSource ./.; + rust-project.defaults.perCrate.crane.args.nativeBuildInputs = with pkgs; [ + clang + perl + pkg-config + ]; rust-project.defaults.perCrate.crane.args.buildInputs = with pkgs; [ clang openssl perl pkg-config ]; + rust-project.crates.openfang-desktop.crane.args.nativeBuildInputs = with pkgs; [ + pkg-config + wrapGAppsHook3 + ]; rust-project.crates.openfang-desktop.crane.args.buildInputs = with pkgs; [ atk glib gtk3 + libayatana-appindicator openssl pkg-config webkitgtk_4_1 ]; + rust-project.crates.openfang-desktop.crane.args.preFixup = '' + gappsWrapperArgs+=( + --prefix LD_LIBRARY_PATH : "${pkgs.libayatana-appindicator}/lib" + ) + ''; packages.default = self'.packages.openfang-cli; apps = {