1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6 autoreconfHook,
7 pkg-config,
8 python3,
9 libxml2,
10 libXinerama,
11 libXcursor,
12 libXau,
13 libXrandr,
14 libICE,
15 libSM,
16 imlib2,
17 pango,
18 libstartup_notification,
19 makeWrapper,
20}:
21
22stdenv.mkDerivation rec {
23 pname = "openbox";
24 version = "3.6.1";
25
26 nativeBuildInputs = [
27 autoreconfHook
28 pkg-config
29 makeWrapper
30 python3.pkgs.wrapPython
31 ];
32
33 buildInputs = [
34 libxml2
35 libXinerama
36 libXcursor
37 libXau
38 libXrandr
39 libICE
40 libSM
41 libstartup_notification
42 python3
43 ];
44
45 propagatedBuildInputs = [
46 pango
47 imlib2
48 ];
49
50 pythonPath = with python3.pkgs; [
51 pyxdg
52 ];
53
54 src = fetchurl {
55 url = "http://openbox.org/dist/openbox/${pname}-${version}.tar.gz";
56 sha256 = "1xvyvqxlhy08n61rjkckmrzah2si1i7nmc7s8h07riqq01vc0jlb";
57 };
58
59 setlayoutSrc = fetchurl {
60 url = "http://openbox.org/dist/tools/setlayout.c";
61 sha256 = "1ci9lq4qqhl31yz1jwwjiawah0f7x0vx44ap8baw7r6rdi00pyiv";
62 };
63
64 patches = [
65 # Use fetchurl to avoid "fetchpatch: ignores file renames" #32084
66 # This patch adds python3 support
67 (fetchurl {
68 url = "https://raw.githubusercontent.com/archlinux/svntogit-community/90cb57ef53d952bb6ab4c33a184f815bbe1791c0/openbox/trunk/py3.patch";
69 sha256 = "1ks99awlkhd5ph9kz94s1r6m1bfvh42g4rmxd14dyg5b421p1ljc";
70 })
71
72 # Fix crash with GLib 2.76. This is proposed on https://bugzilla.icculus.org/show_bug.cgi?id=6669
73 # and committed to a work branch in the upstream repo. See https://bugs.archlinux.org/task/77853.
74 (fetchpatch {
75 url = "https://github.com/Mikachu/openbox/commit/d41128e5a1002af41c976c8860f8299cfcd3cd72.patch";
76 sha256 = "sha256-4/aoI4y98JPybZ1MNI7egOhkroQgh/oeGnYrhNGX4t4=";
77 })
78 ];
79
80 postBuild = "gcc -O2 -o setlayout $(pkg-config --cflags --libs x11) $setlayoutSrc";
81
82 # Openbox needs XDG_DATA_DIRS set or it can't find its default theme
83 postInstall = ''
84 cp -a setlayout "$out"/bin
85 wrapProgram "$out/bin/openbox" --prefix XDG_DATA_DIRS : "$out/share"
86 wrapProgram "$out/bin/openbox-session" --prefix XDG_DATA_DIRS : "$out/share"
87 wrapProgram "$out/bin/openbox-gnome-session" --prefix XDG_DATA_DIRS : "$out/share"
88 wrapProgram "$out/bin/openbox-kde-session" --prefix XDG_DATA_DIRS : "$out/share"
89 wrapPythonProgramsIn "$out/libexec" "$out $pythonPath"
90 '';
91
92 meta = {
93 description = "X window manager for non-desktop embedded systems";
94 homepage = "http://openbox.org/";
95 license = lib.licenses.gpl2Plus;
96 platforms = lib.platforms.linux;
97 };
98}