9 , harfbuzz # can be replaced with libotf
12 , libssh2 #build-in ssh
17 , wrapGAppsHook3 #color picker in mlconfig
21 # List of gui libraries to use. According to `./configure --help` ran on
22 # release 3.9.3, options are: (xlib|win32|fb|quartz|console|wayland|sdl2|beos)
25 # From some reason, upstream's ./configure script disables compilation of the
26 # external tool `mlconfig` if `enableGuis.fb == true`. This behavior is not
27 # documentd in `./configure --help`, and it is reported here:
28 # https://github.com/arakiken/mlterm/issues/73
30 quartz = stdenv.hostPlatform.isDarwin;
31 wayland = stdenv.hostPlatform.isLinux;
35 , wayland # for the "wayland" --with-gui option
36 , SDL2 # for the "sdl" --with-gui option
37 # List of typing engines, the default list enables compiling all of the
38 # available ones, as recorded on release 3.9.3
39 , enableTypeEngines ? {
40 xcore = false; # Considered legacy
47 # List of external tools to create, this default list includes all default
48 # tools, as recorded on release 3.9.3.
54 # Note that according to upstream's ./configure script, to disable
55 # mlimgloader you have to disable _all_ tools. See:
56 # https://github.com/arakiken/mlterm/issues/69
61 # Whether to enable the X window system
62 , enableX11 ? stdenv.hostPlatform.isLinux
63 # Most of the input methods and other build features are enabled by default,
64 # the following attribute set can be used to disable some of them. It's parsed
65 # when we set `configureFlags`. If you find other configure Flags that require
66 # dependencies, it'd be nice to make that contribution here.
68 uim = !stdenv.hostPlatform.isDarwin;
69 ibus = !stdenv.hostPlatform.isDarwin;
70 fcitx = !stdenv.hostPlatform.isDarwin;
71 m17n = !stdenv.hostPlatform.isDarwin;
74 # Open Type layout support, (substituting glyphs with opentype fonts)
77 # Configure the Exec directive in the generated .desktop file
79 if enableGuis.xlib then
81 else if enableGuis.wayland then
83 else if enableGuis.sdl2 then
86 throw "mlterm: couldn't figure out what desktopBinary to use."
91 # Returns a --with-feature=<comma separated string list of all `true`
92 # attributes>, or `--without-feature` if all attributes are false or don't
93 # exist. Used later in configureFlags
94 withFeaturesList = featureName: attrset: let
95 commaSepList = lib.concatStringsSep "," (builtins.attrNames (lib.filterAttrs (n: v: v) attrset));
97 lib.withFeatureAs (commaSepList != "") featureName commaSepList
99 in stdenv.mkDerivation (finalAttrs: {
103 src = fetchFromGitHub {
106 rev = finalAttrs.version;
107 sha256 = "sha256-gfs5cdwUUwSBWwJJSaxrQGWJvLkI27RMlk5QvDALEDg=";
110 nativeBuildInputs = [
113 ] ++ lib.optionals enableTools.mlconfig [
120 ] ++ lib.optionals enableTypeEngines.xcore [
122 ] ++ lib.optionals enableTypeEngines.xft [
124 ] ++ lib.optionals enableTypeEngines.cairo [
126 ] ++ lib.optionals enableGuis.wayland [
129 ] ++ lib.optionals enableGuis.sdl2 [
131 ] ++ lib.optionals enableFeatures.otl [
133 ] ++ lib.optionals enableFeatures.bidi [
135 ] ++ lib.optionals enableFeatures.ssh2 [
137 ] ++ lib.optionals enableFeatures.m17n [
139 ] ++ lib.optionals enableFeatures.fcitx [
142 ] ++ lib.optionals enableFeatures.ibus [
144 ] ++ lib.optionals enableFeatures.uim [
148 #bad configure.ac and Makefile.in everywhere
150 sed -ie 's;-L/usr/local/lib -R/usr/local/lib;;g' \
152 tool/mlfc/Makefile.in \
153 tool/mlimgloader/Makefile.in \
154 tool/mlconfig/Makefile.in \
155 uitoolkit/libtype/Makefile.in \
156 uitoolkit/libotl/Makefile.in
157 sed -ie 's;cd ..srcdir. && rm -f ...lang..gmo.*;;g' \
158 tool/mlconfig/po/Makefile.in.in
160 substituteInPlace configure.in \
161 --replace "-m 2755 -g utmp" " " \
162 --replace "-m 4755 -o root" " "
163 substituteInPlace configure \
164 --replace "-m 2755 -g utmp" " " \
165 --replace "-m 4755 -o root" " "
168 env = lib.optionalAttrs stdenv.cc.isClang {
169 NIX_CFLAGS_COMPILE = "-Wno-error=int-conversion -Wno-error=incompatible-function-pointer-types";
173 (withFeaturesList "type-engines" enableTypeEngines)
174 (withFeaturesList "tools" enableTools)
175 (withFeaturesList "gui" enableGuis)
176 (lib.withFeature enableX11 "x")
177 ] ++ lib.optionals (gtk != null) [
178 "--with-gtk=${lib.versions.major gtk.version}.0"
179 ] ++ (lib.mapAttrsToList (n: v: lib.enableFeature v n) enableFeatures) ++ [
182 enableParallelBuilding = true;
185 install -D contrib/icon/mlterm-icon.svg "$out/share/icons/hicolor/scalable/apps/mlterm.svg"
186 install -D contrib/icon/mlterm-icon-gnome2.png "$out/share/icons/hicolor/48x48/apps/mlterm.png"
187 install -D -t $out/share/applications $desktopItem/share/applications/*
188 '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
189 mkdir -p $out/Applications/
190 cp -a cocoa/mlterm.app $out/Applications/
191 install $out/bin/mlterm -Dt $out/Applications/mlterm.app/Contents/MacOS/
194 desktopItem = makeDesktopItem {
196 exec = "${desktopBinary} %U";
198 type = "Application";
199 comment = "Multi Lingual TERMinal emulator";
200 desktopName = "mlterm";
201 genericName = "Terminal emulator";
202 categories = [ "System" "TerminalEmulator" ];
203 startupNotify = false;
207 tests.test = nixosTests.terminal-emulators.mlterm;
217 description = "Multi Lingual TERMinal emulator";
218 homepage = "https://mlterm.sourceforge.net/";
219 license = licenses.bsd3;
220 maintainers = with maintainers; [ ramkromberg atemu doronbehar ];
221 platforms = platforms.all;
222 mainProgram = desktopBinary;