diff --git a/pkgs/by-name/be/bemenu/package.nix b/pkgs/by-name/be/bemenu/package.nix index ace85ff9ec1b..0da5facf1bbe 100644 --- a/pkgs/by-name/be/bemenu/package.nix +++ b/pkgs/by-name/be/bemenu/package.nix @@ -9,13 +9,14 @@ harfbuzz, pkg-config, scdoc, + makeWrapper, ncursesSupport ? true, ncurses, - waylandSupport ? true, + waylandSupport ? stdenv.hostPlatform.isLinux, wayland, wayland-protocols, wayland-scanner, - x11Support ? true, + x11Support ? stdenv.hostPlatform.isLinux, xorg, }: @@ -30,11 +31,18 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-0vpqJ2jydTt6aVni0ma0g+80PFz+C4xJ5M77sMODkSg="; }; + postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' + substituteInPlace GNUmakefile --replace '-soname' '-install_name' + ''; + strictDeps = true; - nativeBuildInputs = [ - pkg-config - scdoc - ] ++ lib.optionals waylandSupport [ wayland-scanner ]; + nativeBuildInputs = + [ + pkg-config + scdoc + ] + ++ lib.optional stdenv.hostPlatform.isDarwin makeWrapper + ++ lib.optional waylandSupport wayland-scanner; buildInputs = [ @@ -66,12 +74,20 @@ stdenv.mkDerivation (finalAttrs: { ++ lib.optional waylandSupport "wayland" ++ lib.optional x11Support "x11"; + postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' + so="$(find "$out/lib" -name "libbemenu.so.[0-9]" -print -quit)" + for f in "$out/bin/"*; do + install_name_tool -change "$(basename $so)" "$so" $f + wrapProgram $f --set BEMENU_BACKEND curses + done + ''; + meta = with lib; { homepage = "https://github.com/Cloudef/bemenu"; description = "Dynamic menu library and client program inspired by dmenu"; license = licenses.gpl3Plus; maintainers = with maintainers; [ crertel ]; mainProgram = "bemenu"; - platforms = with platforms; linux; + platforms = with platforms; linux ++ darwin; }; })