Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv 2, fetchurl 3, copper 4, python3 5, pkg-config 6, withQt ? false, qtbase ? null, wrapQtAppsHook ? null 7, withGtk2 ? false, gtk2 8, withGtk3 ? false, gtk3 9, mkDerivation ? stdenv.mkDerivation 10}: 11let onlyOneEnabled = xs: 1 == builtins.length (builtins.filter lib.id xs); 12in assert onlyOneEnabled [ withQt withGtk2 withGtk3 ]; 13mkDerivation rec { 14 pname = "code-browser"; 15 version = "8.0"; 16 src = fetchurl { 17 url = "https://tibleiz.net/download/code-browser-${version}-src.tar.gz"; 18 sha256 = "sha256-beCp4lx4MI1+hVgWp2h3piE/zu51zfwQdB5g7ImgmwY="; 19 }; 20 postPatch = '' 21 substituteInPlace Makefile --replace "LFLAGS=-no-pie" "LFLAGS=-no-pie -L." 22 patchShebangs . 23 '' 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" 27 '' 28 + lib.optionalString withGtk2 '' 29 substituteInPlace libs/copper-ui/Makefile --replace "all: qt gtk gtk2" "all: gtk2" 30 '' 31 + lib.optionalString withGtk3 '' 32 substituteInPlace libs/copper-ui/Makefile --replace "all: qt gtk gtk2" "all: gtk" 33 '' 34 ; 35 nativeBuildInputs = [ copper 36 python3 37 pkg-config 38 ] 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 ]; 45 makeFlags = [ 46 "prefix=$(out)" 47 "COPPER=${copper}/bin/copper-elf64" 48 "with-local-libs" 49 ] 50 ++ lib.optionals withQt [ "QINC=${qtbase.dev}/include" 51 "UI=qt" 52 ] 53 ++ lib.optionals withGtk2 [ "UI=gtk2" ] 54 ++ lib.optionals withGtk3 [ "UI=gtk" ]; 55 56 meta = with lib; { 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; 61 }; 62}