@@ -1,41 +1,82 @@
1−{ stdenv, lib, fetchFromGitHub, pkg-config, uthash, asciidoc, docbook_xml_dtd_45
2−, docbook_xsl, libxslt, libxml2, makeWrapper, meson, ninja
3−, xorgproto, libxcb ,xcbutilrenderutil, xcbutilimage, pixman, libev
4−, dbus, libconfig, libdrm, libGL, pcre, libX11
5−, libXinerama, libXext, xwininfo, libxdg_basedir }:
1+{ asciidoc
2+, dbus
3+, docbook_xml_dtd_45
4+, docbook_xsl
5+, fetchFromGitHub
6+, lib
7+, libconfig
8+, libdrm
9+, libev
10+, libGL
11+, libX11
12+, libxcb
13+, libxdg_basedir
14+, libXext
15+, libXinerama
16+, libxml2
17+, libxslt
18+, makeWrapper
19+, meson
20+, ninja
21+, pcre
22+, pixman
23+, pkg-config
24+, stdenv
25+, uthash
26+, xcbutilimage
27+, xcbutilrenderutil
28+, xorgproto
29+, xwininfo
30+, withDebug ? false
31+}:
632
733stdenv.mkDerivation rec {
834 pname = "picom";
935 version = "8.2";
1036
1137 src = fetchFromGitHub {
12− owner = "yshui";
13− repo = "picom";
14− rev = "v${version}";
38+ owner = "yshui";
39+ repo = "picom";
40+ rev = "v${version}";
1541 sha256 = "0gjksayz2xpmgglvw17ppsan2imrd1fijs579kbf27xwp503xgfl";
1642 fetchSubmodules = true;
1743 };
1844
1945 nativeBuildInputs = [
20− meson ninja
21− pkg-config
22− uthash
2346 asciidoc
2447 docbook_xml_dtd_45
2548 docbook_xsl
2649 makeWrapper
50+ meson
51+ ninja
52+ pkg-config
53+ uthash
2754 ];
2855
2956 buildInputs = [
30− dbus libX11 libXext
31− xorgproto
32− libXinerama libdrm pcre libxml2 libxslt libconfig libGL
33− libxcb xcbutilrenderutil xcbutilimage
34− pixman libev
57+ dbus
58+ libconfig
59+ libdrm
60+ libev
61+ libGL
62+ libX11
63+ libxcb
3564 libxdg_basedir
65+ libXext
66+ libXinerama
67+ libxml2
68+ libxslt
69+ pcre
70+ pixman
71+ xcbutilimage
72+ xcbutilrenderutil
73+ xorgproto
3674 ];
3775
38− mesonBuildType = "release";
76+ # Use "debugoptimized" instead of "debug" so perhaps picom works better in
77+ # normal usage too, not just temporary debugging.
78+ mesonBuildType = if withDebug then "debugoptimized" else "release";
79+ dontStrip = withDebug;
3980
4081 mesonFlags = [
4182 "-Dwith_docs=true"
@@ -43,9 +84,13 @@ stdenv.mkDerivation rec {
4384
4485 installFlags = [ "PREFIX=$(out)" ];
4586
87+ # In debug mode, also copy src directory to store. If you then run `gdb picom`
88+ # in the bin directory of picom store path, gdb finds the source files.
4689 postInstall = ''
4790 wrapProgram $out/bin/picom-trans \
4891 --prefix PATH : ${lib.makeBinPath [ xwininfo ]}
92+ '' + lib.optionalString withDebug ''
93+ cp -r ../src $out/
4994 '';
5095
5196 meta = with lib; {
@@ -56,6 +101,13 @@ stdenv.mkDerivation rec {
56101 extensions. It enables basic eye-candy effects. This fork adds
57102 additional features, such as additional effects, and a fork at a
58103 well-defined and proper place.
104+
105+ The package can be installed in debug mode as:
106+
107+ picom.override { withDebug = true; }
108+
109+ For gdb to find the source files, you need to run gdb in the bin directory
110+ of picom package in the nix store.
59111 '';
60112 license = licenses.mit;
61113 homepage = "https://github.com/yshui/picom";