1
0
mirror of https://github.com/Cloudef/bemenu synced 2024-11-23 01:12:01 +01:00
bemenu/default.nix
Jari Vetoniemi 1c3eeb09d5 nix: update default.nix
* reduce src fileset to avoid unneccessary rebuilds
* test symbol visibility
2024-04-02 19:07:45 +09:00

83 lines
1.8 KiB
Nix

{
lib
, stdenv
, pkg-config
, scdoc
, ncurses
, cairo
, fribidi
, harfbuzz
, libxkbcommon
, pango
, wayland
, wayland-scanner
, wayland-protocols
, xorg
}:
with builtins;
with lib;
let
version = readFile ./VERSION;
in stdenv.mkDerivation {
src = with fileset; toSource {
root = ./.;
fileset = unions [ ./VERSION ./GNUmakefile ./bemenu.pc.in ./scripts ./lib ./man ./client ];
};
inherit version;
pname = "bemenu";
strictDeps = true;
nativeBuildInputs = [
pkg-config
scdoc
] ++ optionals (stdenv.isLinux) [
wayland-scanner
];
buildInputs = [
ncurses
] ++ optionals (stdenv.isLinux) [
cairo
fribidi
harfbuzz
libxkbcommon
pango
# Wayland
wayland wayland-protocols
# X11
xorg.libX11 xorg.libXinerama xorg.libXft
xorg.libXdmcp xorg.libpthreadstubs xorg.libxcb
];
postPatch = "" + optionalString (stdenv.isDarwin) ''
substituteInPlace GNUmakefile --replace '-soname' '-install_name'
'';
makeFlags = [ "PREFIX=$(out)" ];
buildFlags = [ "PREFIX=$(out)" "clients" "curses" ] ++ optionals (stdenv.isLinux) [ "wayland" "x11" ];
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/fix-darwin-dylib-names.sh
# ^ does not handle .so files
postInstall = "" + optionalString (stdenv.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
done
'';
doCheck = stdenv.isLinux;
checkPhase = ''
make check-symbols
'';
meta = {
homepage = "https://github.com/Cloudef/bemenu";
description = "Dynamic menu library and client program inspired by dmenu";
license = licenses.gpl3Plus;
platforms = with platforms; darwin ++ linux;
mainProgram = "bemenu-run";
};
}