summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorOrivej Desh <orivej@gmx.fr>2017-12-20 05:46:54 +0000
committerOrivej Desh <orivej@gmx.fr>2017-12-20 08:10:05 +0000
commitb693f989f65d55d2213c52b716cf26fe60e40ad0 (patch)
tree25f2e2ae14736e55fc926bc827b828fcca10ebe3 /pkgs/applications
parentc47ac0d8bf43543d8dcef4895167dd1f7af9d968 (diff)
downloadnixlib-b693f989f65d55d2213c52b716cf26fe60e40ad0.tar
nixlib-b693f989f65d55d2213c52b716cf26fe60e40ad0.tar.gz
nixlib-b693f989f65d55d2213c52b716cf26fe60e40ad0.tar.bz2
nixlib-b693f989f65d55d2213c52b716cf26fe60e40ad0.tar.lz
nixlib-b693f989f65d55d2213c52b716cf26fe60e40ad0.tar.xz
nixlib-b693f989f65d55d2213c52b716cf26fe60e40ad0.tar.zst
nixlib-b693f989f65d55d2213c52b716cf26fe60e40ad0.zip
keepassxc: support macOS
Closes #32879, taking the new description from the PR
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/misc/keepassx/cmake.patch18
-rw-r--r--pkgs/applications/misc/keepassx/community.nix27
-rw-r--r--pkgs/applications/misc/keepassx/darwin.patch52
3 files changed, 89 insertions, 8 deletions
diff --git a/pkgs/applications/misc/keepassx/cmake.patch b/pkgs/applications/misc/keepassx/cmake.patch
new file mode 100644
index 000000000000..4ddf8b2e7e99
--- /dev/null
+++ b/pkgs/applications/misc/keepassx/cmake.patch
@@ -0,0 +1,18 @@
+Fix "No known features for CXX compiler", see
+https://cmake.org/pipermail/cmake/2016-December/064733.html and the note at
+https://cmake.org/cmake/help/v3.10/command/cmake_minimum_required.html
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -20,10 +20,10 @@ if(NOT CMAKE_BUILD_TYPE)
+       FORCE)
+ endif()
+ 
+-project(KeePassXC)
+-
+ cmake_minimum_required(VERSION 3.1.0)
+ 
++project(KeePassXC)
++
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+ 
+ # Support Visual Studio Code
diff --git a/pkgs/applications/misc/keepassx/community.nix b/pkgs/applications/misc/keepassx/community.nix
index acf37f699b38..2f08fbd5fc7a 100644
--- a/pkgs/applications/misc/keepassx/community.nix
+++ b/pkgs/applications/misc/keepassx/community.nix
@@ -1,5 +1,5 @@
-{ stdenv, fetchFromGitHub, fetchpatch,
-  cmake, libgcrypt, zlib, libmicrohttpd, libXtst, qtbase, qttools, libgpgerror, glibcLocales, libyubikey, yubikey-personalization, libXi, qtx11extras
+{ stdenv, fetchFromGitHub, cmake, makeWrapper, qttools
+, libgcrypt, zlib, libmicrohttpd, libXtst, qtbase, libgpgerror, glibcLocales, libyubikey, yubikey-personalization, libXi, qtx11extras
 , withKeePassHTTP ? true
 }:
 
@@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
     sha256 = "0q913v2ka6p7jr7c4w9fq8aqh5v6nxqgcv9h7zllk5p0amsf8d80";
   };
 
+  patches = [ ./cmake.patch ./darwin.patch ];
+
   cmakeFlags = [
     "-DWITH_GUI_TESTS=ON"
     "-DWITH_XC_AUTOTYPE=ON"
@@ -28,13 +30,22 @@ stdenv.mkDerivation rec {
     make test ARGS+="-E testgui --output-on-failure"
   '';
 
-  buildInputs = [ cmake libgcrypt zlib qtbase qttools libXtst libmicrohttpd libgpgerror glibcLocales libyubikey yubikey-personalization libXi qtx11extras ];
+  nativeBuildInputs = [ cmake makeWrapper qttools ];
+
+  buildInputs = [ libgcrypt zlib qtbase libXtst libmicrohttpd libgpgerror glibcLocales libyubikey yubikey-personalization libXi qtx11extras ];
+
+  postInstall = optionalString stdenv.isDarwin ''
+    # Make it work without Qt in PATH.
+    wrapProgram $out/Applications/KeePassXC.app/Contents/MacOS/KeePassXC \
+      --set QT_PLUGIN_PATH ${qtbase.bin}/${qtbase.qtPluginPrefix}
+  '';
 
   meta = {
-    description = "Fork of the keepassX password-manager with additional http-interface to allow browser-integration an use with plugins such as PasslFox (https://github.com/pfn/passifox). See also keepassX2.";
-    homepage = https://github.com/keepassxreboot/keepassxc;
-    license = stdenv.lib.licenses.gpl2;
-    maintainers = with stdenv.lib.maintainers; [ s1lvester jonafato ];
-    platforms = with stdenv.lib.platforms; linux;
+    description = "Password manager to store your passwords safely and auto-type them into your everyday websites and applications";
+    longDescription = "A community fork of KeePassX, which is itself a port of KeePass Password Safe. The goal is to extend and improve KeePassX with new features and bugfixes to provide a feature-rich, fully cross-platform and modern open-source password manager. Accessible via native cross-platform GUI and via CLI. Includes optional http-interface to allow browser-integration with plugins like PassIFox (https://github.com/pfn/passifox).";
+    homepage = https://keepassxc.org/;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ s1lvester jonafato ];
+    platforms = with platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/applications/misc/keepassx/darwin.patch b/pkgs/applications/misc/keepassx/darwin.patch
new file mode 100644
index 000000000000..85fc49e36365
--- /dev/null
+++ b/pkgs/applications/misc/keepassx/darwin.patch
@@ -0,0 +1,52 @@
+Remove the use of macdeployqt to avoid copying dependencies and
+reduce installation size from 90 MB to 9 MB.
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -188,8 +188,8 @@ else()
+   set(PROGNAME keepassxc)
+ endif()
+ 
+-if(APPLE AND WITH_APP_BUNDLE AND "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr/local")
+-  set(CMAKE_INSTALL_PREFIX "/Applications")
++if(APPLE AND WITH_APP_BUNDLE)
++  set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/Applications")
+ endif()
+ 
+ if(MINGW)
+@@ -198,7 +198,7 @@ if(MINGW)
+   set(PLUGIN_INSTALL_DIR ".")
+   set(DATA_INSTALL_DIR   "share")
+ elseif(APPLE AND WITH_APP_BUNDLE)
+-  set(CLI_INSTALL_DIR    "/usr/local/bin")
++  set(CLI_INSTALL_DIR    "../bin")
+   set(BIN_INSTALL_DIR    ".")
+   set(PLUGIN_INSTALL_DIR "${PROGNAME}.app/Contents/PlugIns")
+   set(DATA_INSTALL_DIR   "${PROGNAME}.app/Contents/Resources")
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 5255186..0175983 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -282,11 +282,6 @@ if(APPLE AND WITH_APP_BUNDLE)
+   if(NOT DEFINED QT_BINARY_DIR)
+     set(QT_BINARY_DIR "/usr/local/opt/qt5/bin" CACHE PATH "QT binary folder")
+   endif()
+-  add_custom_command(TARGET ${PROGNAME}
+-                     POST_BUILD
+-                     COMMAND ${QT_BINARY_DIR}/macdeployqt ${PROGNAME}.app
+-                     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
+-                     COMMENT "Deploying app bundle")
+ endif()
+ 
+ if(MINGW)
+diff --git a/src/autotype/mac/CMakeLists.txt b/src/autotype/mac/CMakeLists.txt
+index ac93de0..03d502e 100644
+--- a/src/autotype/mac/CMakeLists.txt
++++ b/src/autotype/mac/CMakeLists.txt
+@@ -16,7 +16,6 @@ if(WITH_APP_BUNDLE)
+   add_custom_command(TARGET keepassx-autotype-cocoa
+                      POST_BUILD
+                      COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libkeepassx-autotype-cocoa.so ${PLUGIN_INSTALL_DIR}
+-                     COMMAND ${QT_BINARY_DIR}/macdeployqt ${PROGNAME}.app -executable=${PLUGIN_INSTALL_DIR}/libkeepassx-autotype-cocoa.so -no-plugins
+                      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src
+   COMMENT "Deploying autotype plugin")
+ else()