From cd8063c4b2175e72fb1b7c50560de20bfb96bc63 Mon Sep 17 00:00:00 2001
From: Charles Strahan <charles.c.strahan@gmail.com>
Date: Sat, 26 Apr 2014 16:56:58 -0400
Subject: [PATCH] finalterm: Add package

---
 pkgs/applications/misc/finalterm/default.nix | 60 ++++++++++++++++++++
 pkgs/top-level/all-packages.nix              |  2 +
 2 files changed, 62 insertions(+)
 create mode 100644 pkgs/applications/misc/finalterm/default.nix

diff --git a/pkgs/applications/misc/finalterm/default.nix b/pkgs/applications/misc/finalterm/default.nix
new file mode 100644
index 000000000000..0c084f9d018c
--- /dev/null
+++ b/pkgs/applications/misc/finalterm/default.nix
@@ -0,0 +1,60 @@
+{ stdenv, lib, fetchFromGitHub, makeWrapper
+, pkgconfig, cmake, libxml2, vala, intltool, libmx, gnome3, gtk3, gtk_doc
+, keybinder3, clutter_gtk, libnotify
+, libxkbcommon, xlibs, udev
+, bashInteractive
+}:
+
+let rev = "5ccde4e8f2c02a398f9172e07c25262ecf954626";
+in stdenv.mkDerivation {
+  name = "finalterm-git-${builtins.substring 0 8 rev}";
+
+  src = fetchFromGitHub {
+    owner = "p-e-w";
+    repo = "finalterm";
+    inherit rev;
+    sha256 = "1gw6nc19whfjd4xj0lc0fmjypn8d7nasif79671859ymnfizyq4f";
+  };
+
+  buildInputs = [
+    pkgconfig cmake vala intltool gtk3 gnome3.gnome_common gnome3.libgee
+    gtk_doc clutter_gtk libmx keybinder3 libxml2 libnotify makeWrapper
+    xlibs.libpthreadstubs xlibs.libXdmcp xlibs.libxshmfence
+    libxkbcommon
+  ] ++ lib.optionals stdenv.isLinux [
+    udev
+  ];
+
+  preConfigure = ''
+    substituteInPlace data/org.gnome.finalterm.gschema.xml \
+      --replace "/bin/bash" "${bashInteractive}/bin/bash"
+
+    cmakeFlagsArray=(
+      -DMINIMAL_FLAGS=ON
+    )
+  '';
+
+  postFixup = ''
+    wrapProgram "$out/bin/finalterm" \
+      --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
+      --prefix GIO_EXTRA_MODULES : "${gnome3.dconf}/lib/gio/modules" \
+      --prefix XDG_DATA_DIRS : "${gnome3.gnome_icon_theme}/share:${gnome3.gtk}/share:$out/share:$GSETTINGS_SCHEMAS_PATH"
+  '';
+
+  meta = with lib; {
+    homepage = "http://finalterm.org";
+    description = "A new breed of terminal emulator";
+    longDescription = ''
+      Final Term is a new breed of terminal emulator.
+
+      It goes beyond mere emulation and understands what is happening inside the shell it is hosting. This allows it to offer features no other terminal can, including:
+
+      - Semantic text menus
+      - Smart command completion
+      - GUI terminal controls
+    '';
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ cstrahan ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 0836c0f082b8..7d9131e3bb01 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -10067,6 +10067,8 @@ let
 
   xterm = callPackage ../applications/misc/xterm { };
 
+  finalterm = callPackage ../applications/misc/finalterm { };
+
   xtrace = callPackage ../tools/X11/xtrace { };
 
   xlaunch = callPackage ../tools/X11/xlaunch { };