forked from Cloudef/bemenu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
74 lines (66 loc) · 1.62 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{
lib
, stdenv
, pkg-config
, scdoc
, ncurses
, cairo
, fribidi
, harfbuzz
, libxkbcommon
, pango
, wayland
, wayland-scanner
, wayland-protocols
, xorg
}:
with builtins;
with lib;
let
src = ./.;
version = readFile "${src}/VERSION";
in stdenv.mkDerivation {
inherit src 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
'';
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";
};
}