about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2018-10-20 23:50:17 +0100
committerGitHub <noreply@github.com>2018-10-20 23:50:17 +0100
commit52ad76f0745359c8853c85b137286b2aa3469475 (patch)
treec315d9309d12b46a633156396e94d5d78a0ff539
parent9b1c2c479b3fe8cbcc1ea3bd5f53ca0d74f42146 (diff)
parent2fdfa2115df58895ad32641df01b31b5815b075f (diff)
downloadnixlib-52ad76f0745359c8853c85b137286b2aa3469475.tar
nixlib-52ad76f0745359c8853c85b137286b2aa3469475.tar.gz
nixlib-52ad76f0745359c8853c85b137286b2aa3469475.tar.bz2
nixlib-52ad76f0745359c8853c85b137286b2aa3469475.tar.lz
nixlib-52ad76f0745359c8853c85b137286b2aa3469475.tar.xz
nixlib-52ad76f0745359c8853c85b137286b2aa3469475.tar.zst
nixlib-52ad76f0745359c8853c85b137286b2aa3469475.zip
Merge pull request #48747 from vlaci/master
kitty: fix locating libstartup-notification-1
-rw-r--r--pkgs/applications/misc/kitty/default.nix18
-rw-r--r--pkgs/applications/misc/kitty/fix-paths.patch27
2 files changed, 35 insertions, 10 deletions
diff --git a/pkgs/applications/misc/kitty/default.nix b/pkgs/applications/misc/kitty/default.nix
index 4febac10806f..8cff766371ea 100644
--- a/pkgs/applications/misc/kitty/default.nix
+++ b/pkgs/applications/misc/kitty/default.nix
@@ -1,5 +1,5 @@
-{ stdenv, fetchFromGitHub, python3Packages, glfw, libunistring, harfbuzz,
-  fontconfig, pkgconfig, ncurses, imagemagick, xsel,
+{ stdenv, substituteAll, fetchFromGitHub, python3Packages, glfw, libunistring,
+  harfbuzz, fontconfig, pkgconfig, ncurses, imagemagick, xsel,
   libstartup_notification, libX11, libXrandr, libXinerama, libXcursor,
   libxkbcommon, libXi, libXext, wayland-protocols, wayland,
   which, dbus
@@ -28,14 +28,12 @@ buildPythonApplication rec {
 
   outputs = [ "out" "terminfo" ];
 
-  postPatch = ''
-    substituteInPlace kitty/utils.py \
-      --replace "find_library('startup-notification-1')" "'${libstartup_notification}/lib/libstartup-notification-1.so'"
-
-    substituteInPlace docs/Makefile \
-      --replace 'python3 .. +launch :sphinx-build' \
-                'PYTHONPATH=$PYTHONPATH:.. HOME=$TMPDIR/nowhere sphinx-build'
-    '';
+  patches = [
+    (substituteAll {
+      src = ./fix-paths.patch;
+      libstartup_notification = "${libstartup_notification}/lib/libstartup-notification-1.so";
+    })
+  ];
 
   buildPhase = ''
     python3 setup.py linux-package
diff --git a/pkgs/applications/misc/kitty/fix-paths.patch b/pkgs/applications/misc/kitty/fix-paths.patch
new file mode 100644
index 000000000000..e22f4570a4b7
--- /dev/null
+++ b/pkgs/applications/misc/kitty/fix-paths.patch
@@ -0,0 +1,27 @@
+--- a/kitty/desktop.c
++++ b/kitty/desktop.c
+@@ -30,7 +30,7 @@
+ static PyObject*
+ init_x11_startup_notification(PyObject UNUSED *self, PyObject *args) {
+     static bool done = false;
+-    static const char* libname = "libstartup-notification-1.so";
++    static const char* libname = "@libstartup_notification@";
+     if (!done) {
+         done = true;
+
+--- a/docs/Makefile
++++ b/docs/Makefile
+@@ -3,7 +3,7 @@
+# Patching is needed here for the following reasons:
+# * `sphinx-build` in nixpkgs is not a Python file but a wrapper shell script
+# * importing the `constants` package from Kitty has a side effect that it
+#   creates the user configuration directory. This package gets imported
+#   while sphinx scans the code for documentation strings.
+#
+ # You can set these variables from the command line.
+ SPHINXOPTS    = -T $(FAIL_WARN)
+-SPHINXBUILD   = python3 .. +launch :sphinx-build
++SPHINXBUILD   = PYTHONPATH=${PYTHONPATH}:.. HOME=${TMPDIR}/kitty-build-home sphinx-build
+ SPHINXPROJ    = kitty
+ SOURCEDIR     = .
+ BUILDDIR      = _build