41 # for some reason the package doesn't build with swig 4.3.0
42 swig_4_2 = swig.overrideAttrs (prevAttrs: {
44 src = prevAttrs.src.override {
45 hash = "sha256-VlUsiRZLScmbC7hZDzKqUr9481YXVwo0eXT/jy6Fda8=";
49 getCoreExe = lib.getExe' coreutils;
51 inherit (python3Packages) paramiko pycairo pyodbc;
53 stdenv.mkDerivation (finalAttrs: {
54 pname = "mysql-workbench";
58 url = "https://cdn.mysql.com/Downloads/MySQLGUITools/mysql-workbench-community-${finalAttrs.version}-src.tar.gz";
59 hash = "sha256-/CrjHgZ3IFFvUB1IxeURme8Z6BoZx0b03MWk8QCe0Sg=";
63 (replaceVars ./hardcode-paths.patch {
64 bash = lib.getExe bash;
65 catchsegv = lib.getExe' glibc "catchsegv";
69 mkdir = getCoreExe "mkdir";
70 nohup = getCoreExe "nohup";
72 rmdir = getCoreExe "rmdir";
73 stat = getCoreExe "stat";
74 sudo = lib.getExe sudo;
77 # Fix swig not being able to find headers
78 # https://github.com/NixOS/nixpkgs/pull/82362#issuecomment-597948461
79 (replaceVars ./fix-swig-build.patch {
80 cairoDev = lib.getDev cairo;
83 # Don't try to override the ANTLR_JAR_PATH specified in cmakeFlags
84 ./dont-search-for-antlr-jar.patch
88 # For some reason CMakeCache.txt is part of source code, remove it
89 rm -f build/CMakeCache.txt
91 patchShebangs tools/get_wb_version.sh
104 antlr4_13.runtime.cpp
106 (libxml2.override { enableHttp = true; })
119 # python dependencies:
123 # TODO: package sqlanydb and add it here
126 env.NIX_CFLAGS_COMPILE = toString (
128 # error: 'OGRErr OGRSpatialReference::importFromWkt(char**)' is deprecated
129 "-Wno-error=deprecated-declarations"
131 ++ lib.optionals stdenv.hostPlatform.isAarch64 [
132 # error: narrowing conversion of '-1' from 'int' to 'char'
133 "-Wno-error=narrowing"
135 ++ lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
136 # Needed with GCC 12 but problematic with some old GCCs
137 "-Wno-error=maybe-uninitialized"
142 (lib.cmakeFeature "MySQL_CONFIG_PATH" (lib.getExe' mysql "mysql_config"))
143 (lib.cmakeFeature "IODBC_CONFIG_PATH" (lib.getExe' libiodbc "iodbc-config"))
144 (lib.cmakeFeature "ANTLR_JAR_PATH" "${antlr4_13.jarLocation}")
145 # mysql-workbench 8.0.21 depends on libmysqlconnectorcpp 1.1.8.
146 # Newer versions of connector still provide the legacy library when enabled
147 # but the headers are in a different location.
148 (lib.cmakeFeature "MySQLCppConn_INCLUDE_DIR" "${lib.getDev libmysqlconnectorcpp}/include/jdbc")
151 # There is already an executable and a wrapper in bindir
152 # No need to wrap both
153 dontWrapGApps = true;
157 --prefix PATH : "${lib.makeBinPath [ python3Packages.python ]}"
158 --prefix PROJSO : "${lib.getLib proj}/lib/libproj.so"
159 --set PYTHONPATH $PYTHONPATH
163 # Let’s wrap the programs not ending with bin
164 # until https://bugs.mysql.com/bug.php?id=91948 is fixed
166 find -L "$out/bin" -type f -executable -print0 \
167 | while IFS= read -r -d ''' file; do
168 if [[ "''${file}" != *-bin ]]; then
169 echo "Wrapping program $file"
176 description = "Visual MySQL database modeling, administration and querying tool";
178 MySQL Workbench is a modeling tool that allows you to design
179 and generate MySQL databases graphically. It also has administration
180 and query development modules where you can manage MySQL server instances
181 and execute SQL queries.
183 homepage = "http://wb.mysql.com/";
184 license = lib.licenses.gpl2Only;
185 mainProgram = "mysql-workbench";
186 maintainers = with lib.maintainers; [ tomasajt ];
187 platforms = lib.platforms.linux;