diff --git a/README.md b/README.md index b286374..268bcd7 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ LD_LIBRARY_PATH=. BEMENU_RENDERERS=. ./bemenu-run ## OSX +### Homebrew + ```sh # Make sure you have GNU Make and pkg-config installed brew install make pkg-config @@ -59,6 +61,15 @@ PKG_CONFIG_PATH="/usr/local/opt/ncurses/lib/pkgconfig" sh build-osx.sh curses # Other than that, follow the normal build steps, but use `build-osx.sh` instead of make ``` +### Nix + +There is darwin.nix provided in this repo, you can install bemenu with it by running +```sh +nix-env -i -f darwin.nix +``` + +This installs only the curses backend. + ## Dependencies - C compiler diff --git a/darwin.nix b/darwin.nix new file mode 100644 index 0000000..8d0b7f8 --- /dev/null +++ b/darwin.nix @@ -0,0 +1,31 @@ +{ pkgs ? import {} }: + +pkgs.stdenv.mkDerivation rec { + name = "bemenu"; + src = ./.; + nativeBuildInputs = with pkgs; [ pkg-config scdoc ]; + buildInputs = with pkgs; [ ncurses ]; + + postPatch = '' + substituteInPlace GNUmakefile --replace '-soname' '-install_name' + ''; + + makeFlags = ["PREFIX=$(out)"]; + buildFlags = ["PREFIX=$(out)" "clients" "curses"]; + + # https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/fix-darwin-dylib-names.sh + # ^ does not handle .so files + postInstall = '' + 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 + done + ''; + + meta = with pkgs.lib; { + homepage = "https://github.com/Cloudef/bemenu"; + description = "Dynamic menu library and client program inspired by dmenu"; + license = licenses.gpl3Plus; + platforms = with platforms; darwin; + }; +}