summary refs log tree commit diff
path: root/pkgs/applications/window-managers/picom
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/window-managers/picom')
-rw-r--r--pkgs/applications/window-managers/picom/default.nix17
1 files changed, 16 insertions, 1 deletions
diff --git a/pkgs/applications/window-managers/picom/default.nix b/pkgs/applications/window-managers/picom/default.nix
index ce0673aab7f..32eee9df0d8 100644
--- a/pkgs/applications/window-managers/picom/default.nix
+++ b/pkgs/applications/window-managers/picom/default.nix
@@ -27,6 +27,7 @@
 , xcbutilrenderutil
 , xorgproto
 , xwininfo
+, withDebug ? false
 }:
 
 stdenv.mkDerivation rec {
@@ -72,7 +73,10 @@ stdenv.mkDerivation rec {
     xorgproto
   ];
 
-  mesonBuildType = "release";
+  # Use "debugoptimized" instead of "debug" so perhaps picom works better in
+  # normal usage too, not just temporary debugging.
+  mesonBuildType = if withDebug then "debugoptimized" else "release";
+  dontStrip = withDebug;
 
   mesonFlags = [
     "-Dwith_docs=true"
@@ -80,9 +84,13 @@ stdenv.mkDerivation rec {
 
   installFlags = [ "PREFIX=$(out)" ];
 
+  # In debug mode, also copy src directory to store. If you then run `gdb picom`
+  # in the bin directory of picom store path, gdb finds the source files.
   postInstall = ''
     wrapProgram $out/bin/picom-trans \
       --prefix PATH : ${lib.makeBinPath [ xwininfo ]}
+  '' + lib.optionalString withDebug ''
+    cp -r ../src $out/
   '';
 
   meta = with lib; {
@@ -93,6 +101,13 @@ stdenv.mkDerivation rec {
       extensions. It enables basic eye-candy effects. This fork adds
       additional features, such as additional effects, and a fork at a
       well-defined and proper place.
+
+      The package can be installed in debug mode as:
+
+        picom.override { withDebug = true; }
+
+      For gdb to find the source files, you need to run gdb in the bin directory
+      of picom package in the nix store.
     '';
     license = licenses.mit;
     homepage = "https://github.com/yshui/picom";