1 { lib, stdenv, fetchFromGitHub, cmake, pkg-config, qt4 ? null
2 , withQt5 ? false, qtbase ? null, qttools ? null
7 assert withQt5 -> qtbase != null;
8 assert withQt5 -> qttools != null;
9 assert stdenv.isDarwin -> darwin != null;
11 stdenv.mkDerivation rec {
12 name = "qtkeychain-${if withQt5 then "qt5" else "qt4"}-${version}";
13 version = "0.9.1"; # verify after nix-build with `grep -R "set(PACKAGE_VERSION " result/`
15 src = fetchFromGitHub {
16 owner = "frankosterfeld";
19 sha256 = "0h4wgngn2yl35hapbjs24amkjfbzsvnna4ixfhn87snjnq5lmjbc"; # v0.9.1
22 dontWrapQtApps = true;
24 patches = (if withQt5 then [] else [ ./0001-Fixes-build-with-Qt4.patch ]) ++ (if stdenv.isDarwin then [ ./0002-Fix-install-name-Darwin.patch ] else []);
26 cmakeFlags = [ "-DQT_TRANSLATIONS_DIR=share/qt/translations" ];
28 nativeBuildInputs = [ cmake ]
29 ++ lib.optionals (!stdenv.isDarwin) [ pkg-config ] # for finding libsecret
32 buildInputs = lib.optionals (!stdenv.isDarwin) [ libsecret ]
33 ++ (if withQt5 then [ qtbase qttools ] else [ qt4 ])
34 ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
35 CoreFoundation Security
40 description = "Platform-independent Qt API for storing passwords securely";
41 homepage = "https://github.com/frankosterfeld/qtkeychain";
42 license = lib.licenses.bsd3;
43 platforms = lib.platforms.unix;