diff --git a/nix/default.nix b/nix/default.nix index 5b59e5140..a31977129 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -2,8 +2,10 @@ lib, stdenv, pkg-config, + makeWrapper, meson, ninja, + binutils, cairo, git, hyprland-protocols, @@ -29,6 +31,7 @@ legacyRenderer ? false, nvidiaPatches ? false, withSystemd ? true, + wrapRuntimeDeps ? true, version ? "git", commit, }: let @@ -56,6 +59,7 @@ in meson ninja pkg-config + makeWrapper ]; outputs = [ @@ -115,6 +119,10 @@ in postInstall = '' ln -s ${wlroots}/include/wlr $dev/include/hyprland/wlroots + ${lib.optionalString wrapRuntimeDeps '' + wrapProgram $out/bin/Hyprland \ + --suffix PATH : ${lib.makeBinPath [ binutils pciutils ]} + ''} ''; passthru.providedSessions = ["hyprland"]; diff --git a/nix/overlays.nix b/nix/overlays.nix index 3b8e22b69..d783f33d6 100644 --- a/nix/overlays.nix +++ b/nix/overlays.nix @@ -25,6 +25,7 @@ in { inherit (final) udis86 hyprland-protocols; }; + hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;}; hyprland-debug = final.hyprland.override {debug = true;}; hyprland-hidpi = final.hyprland.override {hidpiXWayland = true;}; hyprland-nvidia = final.hyprland.override {nvidiaPatches = true;}; diff --git a/src/plugins/PluginAPI.cpp b/src/plugins/PluginAPI.cpp index d8b3c82d0..48500ee40 100644 --- a/src/plugins/PluginAPI.cpp +++ b/src/plugins/PluginAPI.cpp @@ -280,11 +280,11 @@ APICALL std::vector HyprlandAPI::findFunctionsByName(HANDLE hand #endif #ifdef __clang__ - static const auto SYMBOLS = execAndGet(("llvm-nm -D -j " + FPATH.string()).c_str()); - static const auto SYMBOLSDEMANGLED = execAndGet(("llvm-nm -D -j --demangle " + FPATH.string()).c_str()); + static const auto SYMBOLS = execAndGet(("llvm-nm -D -j \"" + FPATH.string() + "\"").c_str()); + static const auto SYMBOLSDEMANGLED = execAndGet(("llvm-nm -D -j --demangle \"" + FPATH.string() + "\"").c_str()); #else - static const auto SYMBOLS = execAndGet(("nm -D -j " + FPATH.string()).c_str()); - static const auto SYMBOLSDEMANGLED = execAndGet(("nm -D -j --demangle=auto " + FPATH.string()).c_str()); + static const auto SYMBOLS = execAndGet(("nm -D -j \"" + FPATH.string() + "\"").c_str()); + static const auto SYMBOLSDEMANGLED = execAndGet(("nm -D -j --demangle=auto \"" + FPATH.string() + "\"").c_str()); #endif auto demangledFromID = [&](size_t id) -> std::string { @@ -301,6 +301,17 @@ APICALL std::vector HyprlandAPI::findFunctionsByName(HANDLE hand return SYMBOLSDEMANGLED.substr(pos, SYMBOLSDEMANGLED.find('\n', pos + 1) - pos); }; + if (SYMBOLS.empty()) { + Debug::log(ERR, "Unable to search for function \"%s\": no symbols found in binary (is \"%s\" in path?)", name.c_str(), +#ifdef __clang__ + "llvm-nm" +#else + "nm" +#endif + ); + return {}; + } + std::vector matches; std::istringstream inStream(SYMBOLS); @@ -319,4 +330,4 @@ APICALL std::vector HyprlandAPI::findFunctionsByName(HANDLE hand } return matches; -} \ No newline at end of file +}