2020-09-04 00:26:11 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, lazarus
|
|
|
|
, fpc
|
|
|
|
, libX11
|
|
|
|
|
|
|
|
# GTK2/3
|
|
|
|
, pango
|
|
|
|
, cairo
|
|
|
|
, glib
|
|
|
|
, atk
|
|
|
|
, gtk2
|
|
|
|
, gtk3
|
|
|
|
, gdk-pixbuf
|
|
|
|
, python3
|
|
|
|
|
|
|
|
# Qt5
|
|
|
|
, libqt5pas
|
|
|
|
, qt5
|
|
|
|
|
|
|
|
, widgetset ? "qt5"
|
|
|
|
# See https://github.com/Alexey-T/CudaText-lexers
|
|
|
|
, additionalLexers ? [ "Nix" ]
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert builtins.elem widgetset [ "gtk2" "gtk3" "qt5" ];
|
|
|
|
|
|
|
|
let
|
|
|
|
deps = lib.mapAttrs
|
|
|
|
(name: spec:
|
|
|
|
fetchFromGitHub {
|
|
|
|
repo = name;
|
2022-08-28 09:07:50 +00:00
|
|
|
inherit (spec) owner rev hash;
|
2020-09-04 00:26:11 +00:00
|
|
|
}
|
|
|
|
)
|
2021-11-03 12:43:23 +00:00
|
|
|
(lib.importJSON ./deps.json);
|
2020-09-04 00:26:11 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "cudatext";
|
2023-03-29 15:14:54 +00:00
|
|
|
version = "1.189.0";
|
2020-09-04 00:26:11 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Alexey-T";
|
|
|
|
repo = "CudaText";
|
|
|
|
rev = version;
|
2023-03-29 15:14:54 +00:00
|
|
|
hash = "sha256-adSX/J/p6E6vz7O5Cg3DgYQjrJYaEcOhYSDQqii68eg=";
|
2020-09-04 00:26:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace app/proc_globdata.pas \
|
|
|
|
--replace "/usr/share/cudatext" "$out/share/cudatext" \
|
2020-12-29 19:07:45 +00:00
|
|
|
--replace "libpython3.so" "${python3}/lib/libpython${python3.pythonVersion}.so" \
|
|
|
|
--replace "AllowProgramUpdates:= true;" "AllowProgramUpdates:= false;"
|
2020-09-04 00:26:11 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ lazarus fpc ]
|
|
|
|
++ lib.optional (widgetset == "qt5") qt5.wrapQtAppsHook;
|
|
|
|
|
|
|
|
buildInputs = [ libX11 ]
|
|
|
|
++ lib.optionals (lib.hasPrefix "gtk" widgetset) [ pango cairo glib atk gdk-pixbuf ]
|
|
|
|
++ lib.optional (widgetset == "gtk2") gtk2
|
|
|
|
++ lib.optional (widgetset == "gtk3") gtk3
|
|
|
|
++ lib.optional (widgetset == "qt5") libqt5pas;
|
|
|
|
|
|
|
|
NIX_LDFLAGS = "--as-needed -rpath ${lib.makeLibraryPath buildInputs}";
|
|
|
|
|
|
|
|
buildPhase = lib.concatStringsSep "\n" (lib.mapAttrsToList (name: dep: ''
|
2023-02-10 19:57:30 +00:00
|
|
|
cp -r ${dep} ${name}
|
2020-09-04 00:26:11 +00:00
|
|
|
'') deps) + ''
|
2023-02-10 19:57:30 +00:00
|
|
|
# See https://wiki.freepascal.org/CudaText#How_to_compile_CudaText
|
|
|
|
substituteInPlace ATSynEdit/atsynedit/atsynedit_package.lpk \
|
|
|
|
--replace GTK2_IME_CODE _GTK2_IME_CODE
|
|
|
|
|
2020-09-04 00:26:11 +00:00
|
|
|
lazbuild --lazarusdir=${lazarus}/share/lazarus --pcp=./lazarus --ws=${widgetset} \
|
2020-10-06 18:35:52 +00:00
|
|
|
bgrabitmap/bgrabitmap/bgrabitmappack.lpk \
|
2020-09-04 00:26:11 +00:00
|
|
|
EncConv/encconv/encconv_package.lpk \
|
|
|
|
ATBinHex-Lazarus/atbinhex/atbinhex_package.lpk \
|
|
|
|
ATFlatControls/atflatcontrols/atflatcontrols_package.lpk \
|
|
|
|
ATSynEdit/atsynedit/atsynedit_package.lpk \
|
|
|
|
ATSynEdit_Cmp/atsynedit_cmp/atsynedit_cmp_package.lpk \
|
|
|
|
EControl/econtrol/econtrol_package.lpk \
|
|
|
|
ATSynEdit_Ex/atsynedit_ex/atsynedit_ex_package.lpk \
|
|
|
|
Python-for-Lazarus/python4lazarus/python4lazarus_package.lpk \
|
|
|
|
Emmet-Pascal/emmet/emmet_package.lpk \
|
|
|
|
app/cudatext.lpi
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2022-06-15 08:49:18 +00:00
|
|
|
install -Dm755 app/cudatext -t $out/bin
|
2020-09-04 00:26:11 +00:00
|
|
|
|
|
|
|
install -dm755 $out/share/cudatext
|
|
|
|
cp -r app/{data,py,settings_default} $out/share/cudatext
|
|
|
|
|
|
|
|
install -Dm644 setup/debfiles/cudatext-512.png -t $out/share/pixmaps
|
|
|
|
install -Dm644 setup/debfiles/cudatext.desktop -t $out/share/applications
|
|
|
|
'' + lib.concatMapStringsSep "\n" (lexer: ''
|
2021-01-28 22:15:20 +00:00
|
|
|
if [ -d "CudaText-lexers/${lexer}" ]; then
|
|
|
|
install -Dm644 CudaText-lexers/${lexer}/*.{cuda-lexmap,lcf} $out/share/cudatext/data/lexlib
|
|
|
|
else
|
|
|
|
echo "${lexer} lexer not found"
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-09-04 00:26:11 +00:00
|
|
|
'') additionalLexers;
|
|
|
|
|
2021-12-12 14:20:57 +00:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
2020-09-04 00:26:11 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Cross-platform code editor";
|
|
|
|
longDescription = ''
|
|
|
|
Text/code editor with lite UI. Syntax highlighting for 200+ languages.
|
|
|
|
Config system in JSON files. Multi-carets and multi-selections.
|
|
|
|
Search and replace with RegEx. Extendable by Python plugins and themes.
|
|
|
|
'';
|
2021-04-11 19:03:48 +00:00
|
|
|
homepage = "https://cudatext.github.io/";
|
|
|
|
changelog = "https://cudatext.github.io/history.txt";
|
2020-09-04 00:26:11 +00:00
|
|
|
license = licenses.mpl20;
|
|
|
|
maintainers = with maintainers; [ sikmir ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|