23 # See https://github.com/Alexey-T/CudaText-lexers
24 , additionalLexers ? [ "Nix" ]
27 assert builtins.elem widgetset [ "gtk2" "gtk3" "qt5" ];
34 inherit (spec) owner rev hash;
37 (lib.importJSON ./deps.json);
39 stdenv.mkDerivation rec {
43 src = fetchFromGitHub {
47 hash = "sha256-ZFMO986D4RtrTnLFdcL0a2BNjcsB+9pIolylblku7j4=";
50 patches = [ ./proc_globdata.patch ];
53 substituteInPlace app/proc_globdata.pas \
55 --subst-var-by python3 ${python3}
58 nativeBuildInputs = [ lazarus fpc ]
59 ++ lib.optional (widgetset == "qt5") qt5.wrapQtAppsHook;
61 buildInputs = [ libX11 ]
62 ++ lib.optionals (lib.hasPrefix "gtk" widgetset) [ pango cairo glib atk gdk-pixbuf ]
63 ++ lib.optional (widgetset == "gtk2") gtk2
64 ++ lib.optional (widgetset == "gtk3") gtk3
65 ++ lib.optional (widgetset == "qt5") libqt5pas;
67 NIX_LDFLAGS = "--as-needed -rpath ${lib.makeLibraryPath buildInputs}";
69 buildPhase = lib.concatStringsSep "\n" (lib.mapAttrsToList (name: dep: ''
72 # See https://wiki.freepascal.org/CudaText#How_to_compile_CudaText
73 substituteInPlace ATSynEdit/atsynedit/atsynedit_package.lpk \
74 --replace GTK2_IME_CODE _GTK2_IME_CODE
76 lazbuild --lazarusdir=${lazarus}/share/lazarus --pcp=./lazarus --ws=${widgetset} \
77 bgrabitmap/bgrabitmap/bgrabitmappack.lpk \
78 EncConv/encconv/encconv_package.lpk \
79 ATBinHex-Lazarus/atbinhex/atbinhex_package.lpk \
80 ATFlatControls/atflatcontrols/atflatcontrols_package.lpk \
81 ATSynEdit/atsynedit/atsynedit_package.lpk \
82 ATSynEdit_Cmp/atsynedit_cmp/atsynedit_cmp_package.lpk \
83 EControl/econtrol/econtrol_package.lpk \
84 ATSynEdit_Ex/atsynedit_ex/atsynedit_ex_package.lpk \
85 Python-for-Lazarus/python4lazarus/python4lazarus_package.lpk \
86 Emmet-Pascal/emmet/emmet_package.lpk \
91 install -Dm755 app/cudatext -t $out/bin
93 install -dm755 $out/share/cudatext
94 cp -r app/{data,py,settings_default} $out/share/cudatext
96 install -Dm644 setup/debfiles/cudatext-512.png -t $out/share/pixmaps
97 install -Dm644 setup/debfiles/cudatext.desktop -t $out/share/applications
98 '' + lib.concatMapStringsSep "\n" (lexer: ''
99 if [ -d "CudaText-lexers/${lexer}" ]; then
100 install -Dm644 CudaText-lexers/${lexer}/*.{cuda-lexmap,lcf} $out/share/cudatext/data/lexlib
102 echo "${lexer} lexer not found"
105 '') additionalLexers;
107 passthru.updateScript = ./update.sh;
110 description = "Cross-platform code editor";
112 Text/code editor with lite UI. Syntax highlighting for 200+ languages.
113 Config system in JSON files. Multi-carets and multi-selections.
114 Search and replace with RegEx. Extendable by Python plugins and themes.
116 homepage = "https://cudatext.github.io/";
117 changelog = "https://cudatext.github.io/history.txt";
118 license = licenses.mpl20;
119 maintainers = with maintainers; [ sikmir ];
120 platforms = platforms.linux;
121 mainProgram = "cudatext";