summary refs log tree commit diff
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@mailbox.org>2017-05-09 18:24:46 -0500
committerThomas Tuegel <ttuegel@mailbox.org>2017-06-18 08:44:44 -0500
commit3acfd310507bb6f41dfa947524dbb329714d2e79 (patch)
tree6438be5c290c5d788ab739170f0ae6f63f96af3b
parentf5c00c43bb6d4a4a09e4b4a8a273833deba994cc (diff)
downloadnixpkgs-3acfd310507bb6f41dfa947524dbb329714d2e79.tar
nixpkgs-3acfd310507bb6f41dfa947524dbb329714d2e79.tar.gz
nixpkgs-3acfd310507bb6f41dfa947524dbb329714d2e79.tar.bz2
nixpkgs-3acfd310507bb6f41dfa947524dbb329714d2e79.tar.lz
nixpkgs-3acfd310507bb6f41dfa947524dbb329714d2e79.tar.xz
nixpkgs-3acfd310507bb6f41dfa947524dbb329714d2e79.tar.zst
nixpkgs-3acfd310507bb6f41dfa947524dbb329714d2e79.zip
akonadi: fix runtime paths
-rw-r--r--pkgs/applications/kde/akonadi.nix20
-rw-r--r--pkgs/applications/kde/akonadi/akonadi-paths.patch105
-rw-r--r--pkgs/applications/kde/akonadi/akonadi-timestamps.patch14
-rw-r--r--pkgs/applications/kde/akonadi/default.nix36
-rw-r--r--pkgs/applications/kde/akonadi/series2
-rw-r--r--pkgs/applications/kde/default.nix2
6 files changed, 158 insertions, 21 deletions
diff --git a/pkgs/applications/kde/akonadi.nix b/pkgs/applications/kde/akonadi.nix
deleted file mode 100644
index 367fdd36fb8..00000000000
--- a/pkgs/applications/kde/akonadi.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-  mkDerivation, lib,
-  extra-cmake-modules,
-  kcompletion, kconfigwidgets, kdbusaddons, kdesignerplugin, kiconthemes,
-  kio,
-  boost, kitemmodels
-}:
-
-mkDerivation {
-  name = "akonadi";
-  meta = {
-    license = [ lib.licenses.lgpl21 ];
-    maintainers = [ lib.maintainers.ttuegel ];
-  };
-  nativeBuildInputs = [ extra-cmake-modules ];
-  buildInputs = [
-    kcompletion kconfigwidgets kdbusaddons kdesignerplugin kiconthemes kio
-  ];
-  propagatedBuildInputs = [ boost kitemmodels ];
-}
diff --git a/pkgs/applications/kde/akonadi/akonadi-paths.patch b/pkgs/applications/kde/akonadi/akonadi-paths.patch
new file mode 100644
index 00000000000..690664791f4
--- /dev/null
+++ b/pkgs/applications/kde/akonadi/akonadi-paths.patch
@@ -0,0 +1,105 @@
+Index: akonadi-17.04.0/src/server/storage/dbconfigmysql.cpp
+===================================================================
+--- akonadi-17.04.0.orig/src/server/storage/dbconfigmysql.cpp
++++ akonadi-17.04.0/src/server/storage/dbconfigmysql.cpp
+@@ -76,20 +76,11 @@ bool DbConfigMysql::init(QSettings &sett
+         defaultServerPath = QStringLiteral(MYSQLD_EXECUTABLE);
+     }
+ #endif
+-    const QStringList mysqldSearchPath = QStringList()
+-                                         << QStringLiteral("/usr/bin")
+-                                         << QStringLiteral("/usr/sbin")
+-                                         << QStringLiteral("/usr/local/sbin")
+-                                         << QStringLiteral("/usr/local/libexec")
+-                                         << QStringLiteral("/usr/libexec")
+-                                         << QStringLiteral("/opt/mysql/libexec")
+-                                         << QStringLiteral("/opt/local/lib/mysql5/bin")
+-                                         << QStringLiteral("/opt/mysql/sbin");
+     if (defaultServerPath.isEmpty()) {
+-        defaultServerPath = XdgBaseDirs::findExecutableFile(QStringLiteral("mysqld"), mysqldSearchPath);
++        defaultServerPath = QStringLiteral(NIXPKGS_MYSQL_MYSQLD);
+     }
+ 
+-    const QString mysqladminPath = XdgBaseDirs::findExecutableFile(QStringLiteral("mysqladmin"), mysqldSearchPath);
++    const QString mysqladminPath = QStringLiteral(NIXPKGS_MYSQL_MYSQLADMIN);
+     if (!mysqladminPath.isEmpty()) {
+ #ifndef Q_OS_WIN
+         defaultCleanShutdownCommand = QStringLiteral("%1 --defaults-file=%2/mysql.conf --socket=%3/mysql.socket shutdown")
+@@ -99,10 +90,10 @@ bool DbConfigMysql::init(QSettings &sett
+ #endif
+     }
+ 
+-    mMysqlInstallDbPath = XdgBaseDirs::findExecutableFile(QStringLiteral("mysql_install_db"), mysqldSearchPath);
++    mMysqlInstallDbPath = QStringLiteral(NIXPKGS_MYSQL_MYSQL_INSTALL_DB);
+     qCDebug(AKONADISERVER_LOG) << "Found mysql_install_db: " << mMysqlInstallDbPath;
+ 
+-    mMysqlCheckPath = XdgBaseDirs::findExecutableFile(QStringLiteral("mysqlcheck"), mysqldSearchPath);
++    mMysqlCheckPath = QStringLiteral(NIXPKGS_MYSQL_MYSQLCHECK);
+     qCDebug(AKONADISERVER_LOG) << "Found mysqlcheck: " << mMysqlCheckPath;
+ 
+     mInternalServer = settings.value(QStringLiteral("QMYSQL/StartServer"), defaultInternalServer).toBool();
+@@ -119,7 +110,7 @@ bool DbConfigMysql::init(QSettings &sett
+     mUserName = settings.value(QStringLiteral("User")).toString();
+     mPassword = settings.value(QStringLiteral("Password")).toString();
+     mConnectionOptions = settings.value(QStringLiteral("Options"), defaultOptions).toString();
+-    mMysqldPath = settings.value(QStringLiteral("ServerPath"), defaultServerPath).toString();
++    mMysqldPath = QStringLiteral(NIXPKGS_MYSQL_MYSQLD);
+     mCleanServerShutdownCommand = settings.value(QStringLiteral("CleanServerShutdownCommand"), defaultCleanShutdownCommand).toString();
+     settings.endGroup();
+ 
+@@ -196,7 +187,7 @@ bool DbConfigMysql::startInternalServer(
+ #endif
+ 
+     // generate config file
+-    const QString globalConfig = XdgBaseDirs::findResourceFile("config", QStringLiteral("akonadi/mysql-global.conf"));
++    const QString globalConfig = QStringLiteral(NIX_OUT "/etc/xdg/akonadi/mysql-global.conf");
+     const QString localConfig  = XdgBaseDirs::findResourceFile("config", QStringLiteral("akonadi/mysql-local.conf"));
+     const QString actualConfig = StandardDirs::saveDir("data") + QLatin1String("/mysql.conf");
+     if (globalConfig.isEmpty()) {
+Index: akonadi-17.04.0/src/server/storage/dbconfigpostgresql.cpp
+===================================================================
+--- akonadi-17.04.0.orig/src/server/storage/dbconfigpostgresql.cpp
++++ akonadi-17.04.0/src/server/storage/dbconfigpostgresql.cpp
+@@ -97,8 +97,8 @@ bool DbConfigPostgresql::init(QSettings
+         }
+         postgresSearchPath.append(postgresVersionedSearchPaths);
+ 
+-        defaultServerPath = XdgBaseDirs::findExecutableFile(QStringLiteral("pg_ctl"), postgresSearchPath);
+-        defaultInitDbPath = XdgBaseDirs::findExecutableFile(QStringLiteral("initdb"), postgresSearchPath);
++        defaultServerPath = QStringLiteral(NIXPKGS_POSTGRES_PG_CTL);
++        defaultInitDbPath = QStringLiteral(NIXPKGS_POSTGRES_INITDB);
+         defaultHostName = Utils::preferredSocketDirectory(StandardDirs::saveDir("data", QStringLiteral("db_misc")));
+         defaultPgData = StandardDirs::saveDir("data", QStringLiteral("db_data"));
+     }
+Index: akonadi-17.04.0/src/akonadicontrol/agentprocessinstance.cpp
+===================================================================
+--- akonadi-17.04.0.orig/src/akonadicontrol/agentprocessinstance.cpp
++++ akonadi-17.04.0/src/akonadicontrol/agentprocessinstance.cpp
+@@ -62,7 +62,7 @@ bool AgentProcessInstance::start(const A
+     } else {
+         Q_ASSERT(agentInfo.launchMethod == AgentType::Launcher);
+         const QStringList arguments = QStringList() << executable << identifier();
+-        const QString agentLauncherExec = XdgBaseDirs::findExecutableFile(QStringLiteral("akonadi_agent_launcher"));
++        const QString agentLauncherExec = QStringLiteral(NIX_OUT "/bin/akonadi_agent_launcher");
+         mController->start(agentLauncherExec, arguments);
+     }
+     return true;
+Index: akonadi-17.04.0/src/akonadicontrol/agentmanager.cpp
+===================================================================
+--- akonadi-17.04.0.orig/src/akonadicontrol/agentmanager.cpp
++++ akonadi-17.04.0/src/akonadicontrol/agentmanager.cpp
+@@ -102,12 +102,12 @@ AgentManager::AgentManager(bool verbose,
+     mStorageController = new Akonadi::ProcessControl;
+     mStorageController->setShutdownTimeout(15 * 1000);   // the server needs more time for shutdown if we are using an internal mysqld
+     connect(mStorageController, &Akonadi::ProcessControl::unableToStart, this, &AgentManager::serverFailure);
+-    mStorageController->start(QStringLiteral("akonadiserver"), serviceArgs, Akonadi::ProcessControl::RestartOnCrash);
++    mStorageController->start(QStringLiteral(NIX_OUT "/bin/akonadiserver"), serviceArgs, Akonadi::ProcessControl::RestartOnCrash);
+ 
+     if (mAgentServerEnabled) {
+         mAgentServer = new Akonadi::ProcessControl;
+         connect(mAgentServer, &Akonadi::ProcessControl::unableToStart, this, &AgentManager::agentServerFailure);
+-        mAgentServer->start(QStringLiteral("akonadi_agent_server"), serviceArgs, Akonadi::ProcessControl::RestartOnCrash);
++        mAgentServer->start(QStringLiteral(NIX_OUT "/bin/akonadi_agent_server"), serviceArgs, Akonadi::ProcessControl::RestartOnCrash);
+     }
+ 
+ #ifndef QT_NO_DEBUG
diff --git a/pkgs/applications/kde/akonadi/akonadi-timestamps.patch b/pkgs/applications/kde/akonadi/akonadi-timestamps.patch
new file mode 100644
index 00000000000..25a835f5ba2
--- /dev/null
+++ b/pkgs/applications/kde/akonadi/akonadi-timestamps.patch
@@ -0,0 +1,14 @@
+Index: akonadi-17.04.0/src/server/storage/dbconfigmysql.cpp
+===================================================================
+--- akonadi-17.04.0.orig/src/server/storage/dbconfigmysql.cpp
++++ akonadi-17.04.0/src/server/storage/dbconfigmysql.cpp
+@@ -229,8 +229,7 @@ bool DbConfigMysql::startInternalServer(
+     bool confUpdate = false;
+     QFile actualFile(actualConfig);
+     // update conf only if either global (or local) is newer than actual
+-    if ((QFileInfo(globalConfig).lastModified() > QFileInfo(actualFile).lastModified()) ||
+-            (QFileInfo(localConfig).lastModified()  > QFileInfo(actualFile).lastModified())) {
++    if (true) {
+         QFile globalFile(globalConfig);
+         QFile localFile(localConfig);
+         if (globalFile.open(QFile::ReadOnly) && actualFile.open(QFile::WriteOnly)) {
diff --git a/pkgs/applications/kde/akonadi/default.nix b/pkgs/applications/kde/akonadi/default.nix
new file mode 100644
index 00000000000..a264ebc9f09
--- /dev/null
+++ b/pkgs/applications/kde/akonadi/default.nix
@@ -0,0 +1,36 @@
+{
+  mkDerivation, copyPathsToStore, lib,
+  extra-cmake-modules,
+  kcompletion, kconfigwidgets, kdbusaddons, kdesignerplugin, kiconthemes,
+  kio,
+  boost, kitemmodels,
+  mysql
+}:
+
+mkDerivation {
+  name = "akonadi";
+  meta = {
+    license = [ lib.licenses.lgpl21 ];
+    maintainers = [ lib.maintainers.ttuegel ];
+  };
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    kcompletion kconfigwidgets kdbusaddons kdesignerplugin kiconthemes kio
+  ];
+  propagatedBuildInputs = [ boost kitemmodels ];
+  cmakeFlags = [
+    "-DMYSQLD_EXECUTABLE=${lib.getBin mysql}/bin/mysqld"
+  ];
+  NIX_CFLAGS_COMPILE = [
+    ''-DNIXPKGS_MYSQL_MYSQLD="${lib.getBin mysql}/bin/mysqld"''
+    ''-DNIXPKGS_MYSQL_MYSQLADMIN="${lib.getBin mysql}/bin/mysqladmin"''
+    ''-DNIXPKGS_MYSQL_MYSQL_INSTALL_DB="${lib.getBin mysql}/bin/mysql_install_db"''
+    ''-DNIXPKGS_MYSQL_MYSQLCHECK="${lib.getBin mysql}/bin/mysqlcheck"''
+    ''-DNIXPKGS_POSTGRES_PG_CTL=""''
+    ''-DNIXPKGS_POSTGRES_INITDB=""''
+  ];
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE+=" -DNIX_OUT=\"$out\""
+  '';
+}
diff --git a/pkgs/applications/kde/akonadi/series b/pkgs/applications/kde/akonadi/series
new file mode 100644
index 00000000000..9e067f0a000
--- /dev/null
+++ b/pkgs/applications/kde/akonadi/series
@@ -0,0 +1,2 @@
+akonadi-paths.patch
+akonadi-timestamps.patch
diff --git a/pkgs/applications/kde/default.nix b/pkgs/applications/kde/default.nix
index 931132cf428..d8b8c4242cb 100644
--- a/pkgs/applications/kde/default.nix
+++ b/pkgs/applications/kde/default.nix
@@ -48,7 +48,7 @@ let
       };
     in {
       kdelibs = callPackage ./kdelibs { inherit attica phonon; };
-      akonadi = callPackage ./akonadi.nix {};
+      akonadi = callPackage ./akonadi {};
       akonadi-contacts = callPackage ./akonadi-contacts.nix {};
       akonadi-mime = callPackage ./akonadi-mime.nix {};
       ark = callPackage ./ark/default.nix {};