lol
1{ stdenv, fetchFromGitHub, python3Packages, glfw, libunistring, harfbuzz,
2 fontconfig, pkgconfig, ncurses, imagemagick, xsel,
3 libstartup_notification, libX11, libXrandr, libXinerama, libXcursor,
4 libxkbcommon, libXi, libXext, wayland-protocols, wayland,
5 which
6}:
7
8with python3Packages;
9buildPythonApplication rec {
10 version = "0.11.3";
11 name = "kitty-${version}";
12 format = "other";
13
14 src = fetchFromGitHub {
15 owner = "kovidgoyal";
16 repo = "kitty";
17 rev = "v${version}";
18 sha256 = "1fql8ayxvip8hgq9gy0dhqfvngv13gh5bf71vnc3agd80kzq1n73";
19 };
20
21 buildInputs = [
22 fontconfig glfw ncurses libunistring harfbuzz libX11
23 libXrandr libXinerama libXcursor libxkbcommon libXi libXext
24 wayland-protocols wayland
25 ];
26
27 nativeBuildInputs = [ pkgconfig which sphinx ];
28
29 outputs = [ "out" "terminfo" ];
30
31 postPatch = ''
32 substituteInPlace kitty/utils.py \
33 --replace "find_library('startup-notification-1')" "'${libstartup_notification}/lib/libstartup-notification-1.so'"
34
35 substituteInPlace docs/Makefile \
36 --replace 'python3 .. +launch $(shell which sphinx-build)' \
37 'PYTHONPATH=$PYTHONPATH:.. HOME=$TMPDIR/nowhere $(shell which sphinx-build)'
38 '';
39
40 buildPhase = ''
41 python3 setup.py linux-package
42 '';
43
44 installPhase = ''
45 runHook preInstall
46 mkdir -p $out
47 cp -r linux-package/{bin,share,lib} $out
48 wrapProgram "$out/bin/kitty" --prefix PATH : "$out/bin:${stdenv.lib.makeBinPath [ imagemagick xsel ]}"
49 runHook postInstall
50 '';
51
52 postInstall = ''
53 mkdir -p $terminfo/share
54 mv $out/share/terminfo $terminfo/share/terminfo
55
56 mkdir -p $out/nix-support
57 echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
58 '';
59
60 meta = with stdenv.lib; {
61 homepage = https://github.com/kovidgoyal/kitty;
62 description = "A modern, hackable, featureful, OpenGL based terminal emulator";
63 license = licenses.gpl3;
64 platforms = platforms.linux;
65 maintainers = with maintainers; [ tex rvolosatovs ];
66 };
67}