about summary refs log tree commit diff
path: root/pkgs/applications/misc/mysql-workbench/default.nix
blob: e373392155a77b484ce2aaff02b14e1490ddabda (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{ stdenv, fetchurl, makeWrapper, autoconf, automake, boost, file, gettext
, glib, glibc, gnome_keyring, gtk, gtkmm, intltool, libctemplate, libglade
, libgnome, libsigcxx, libtool, libuuid, libxml2, libzip, lua, mesa, mysql
, pango, paramiko, pcre, pexpect, pkgconfig, pycrypto, python, sqlite
}:

stdenv.mkDerivation rec {
  pname = "mysql-workbench";
  version = "5.2.30";
  name = "${pname}-${version}";

  src = fetchurl {
    url = "http://mirror.services.wisc.edu/mysql/Downloads/MySQLGUITools/mysql-workbench-gpl-${version}-src.tar.gz";
    sha256 = "0dlhnq7pv2ccgm0d7a3hzf9jxa09jzw36h0ljs9vw9q5nyd5kq71";
  };

  buildInputs = [ autoconf automake boost file gettext glib glibc gnome_keyring gtk gtkmm intltool
    libctemplate libglade libgnome libsigcxx libtool libuuid libxml2 libzip lua makeWrapper mesa
    mysql paramiko pcre pexpect pkgconfig pycrypto python sqlite ];

  preConfigure = ''
    substituteInPlace $(pwd)/frontend/linux/workbench/mysql-workbench.in --replace "catchsegv" "${glibc}/bin/catchsegv"

    ./autogen.sh --prefix=$out
  '';

  postInstall = ''
    wrapProgram "$out/bin/mysql-workbench-bin" \
      --prefix LD_LIBRARY_PATH : "${python}/lib" \
      --prefix LD_LIBRARY_PATH : "$(cat ${stdenv.gcc}/nix-support/orig-gcc)/lib64" \
      --prefix PATH : "${gnome_keyring}/bin" \
      --set PYTHONPATH $PYTHONPATH \
      --run '
# The gnome-keyring-daemon must be running.  To allow for environments like
# kde, xfce where this is not so, we start it first.
# It is cleaned up using a supervisor subshell which detects that
# the parent has finished via the closed pipe as terminate signal idiom,
# used because we cannot clean up after ourselves due to the exec call.

# Start gnome-keyring-daemon, export the environment variables it asks us to set.
for expr in $( gnome-keyring-daemon --components=ssh,pkcs11 --start ) ; do eval "export "$expr ; done

# Prepare fifo pipe.
FIFOCTL="/tmp/gnome-keyring-daemon-ctl.$$.fifo"
[ -p $FIFOCTL ] && rm $FIFOCTL
mkfifo $FIFOCTL

# Supervisor subshell waits reading from pipe, will receive EOF when parent
# closes pipe on termination.  Negate read with ! operator to avoid subshell
# quitting when read EOF returns 1 due to -e option being set.
(
    exec 19< $FIFOCTL
    ! read -u 19

    kill $GNOME_KEYRING_PID
    rm $FIFOCTL
) &

exec 19> $FIFOCTL
            ' 
  '';

  meta = with stdenv.lib; {
    description = "A MySQL visual database modeling, administration and querying tool.";
    longDescription = ''
      MySQL Workbench is a modeling tool that allows you to design
      and generate MySQL databases graphically. It also has administration
      and query development modules where you can manage MySQL server instances
      and execute SQL queries.
    '';

    homepage = http://wb.mysql.com/;
    license = licenses.gpl2;
    maintainers = [ maintainers.kkallio ];
    platforms = platforms.linux;
  };
}