6 , withQt ? false, qtbase ? null, wrapQtAppsHook ? null
7 , withGtk2 ? false, gtk2
8 , withGtk3 ? false, gtk3
9 , mkDerivation ? stdenv.mkDerivation
11 let onlyOneEnabled = xs: 1 == builtins.length (builtins.filter lib.id xs);
12 in assert onlyOneEnabled [ withQt withGtk2 withGtk3 ];
14 pname = "code-browser";
17 url = "https://tibleiz.net/download/code-browser-${version}-src.tar.gz";
18 sha256 = "sha256-beCp4lx4MI1+hVgWp2h3piE/zu51zfwQdB5g7ImgmwY=";
21 substituteInPlace Makefile --replace "LFLAGS=-no-pie" "LFLAGS=-no-pie -L."
24 + lib.optionalString withQt ''
25 substituteInPlace libs/copper-ui/Makefile --replace "moc -o" "${qtbase.dev}/bin/moc -o"
26 substituteInPlace libs/copper-ui/Makefile --replace "all: qt gtk gtk2" "all: qt"
28 + lib.optionalString withGtk2 ''
29 substituteInPlace libs/copper-ui/Makefile --replace "all: qt gtk gtk2" "all: gtk2"
31 + lib.optionalString withGtk3 ''
32 substituteInPlace libs/copper-ui/Makefile --replace "all: qt gtk gtk2" "all: gtk"
35 nativeBuildInputs = [ copper
39 ++ lib.optionals withGtk2 [ gtk2 ]
40 ++ lib.optionals withGtk3 [ gtk3 ]
41 ++ lib.optionals withQt [ qtbase wrapQtAppsHook ];
42 buildInputs = lib.optionals withQt [ qtbase ]
43 ++ lib.optionals withGtk2 [ gtk2 ]
44 ++ lib.optionals withGtk3 [ gtk3 ];
47 "COPPER=${copper}/bin/copper-elf64"
50 ++ lib.optionals withQt [ "QINC=${qtbase.dev}/include"
53 ++ lib.optionals withGtk2 [ "UI=gtk2" ]
54 ++ lib.optionals withGtk3 [ "UI=gtk" ];
57 description = "Folding text editor, designed to hierarchically structure any kind of text file and especially source code";
58 homepage = "https://tibleiz.net/code-browser/";
59 license = licenses.gpl2;
60 platforms = platforms.x86_64;