29 , withKeePassBrowser ? true
30 , withKeePassBrowserPasskeys ? true
31 , withKeePassFDOSecrets ? true
32 , withKeePassKeeShare ? true
33 , withKeePassNetworking ? true
34 , withKeePassSSHAgent ? true
35 , withKeePassTouchID ? true
36 , withKeePassX11 ? true
37 , withKeePassYubiKey ? true
42 stdenv.mkDerivation rec {
46 src = fetchFromGitHub {
47 owner = "keepassxreboot";
50 hash = "sha256-HjDzb1H3eMSraKbfHgg9S+w4TXNt40lQkDz+EChb5Ks=";
53 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang (toString [
56 "-D__BIG_ENDIAN__=${if stdenv.isBigEndian then "1" else "0"}"
59 NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-rpath ${libargon2}/lib";
66 "-DKEEPASSXC_BUILD_TYPE=Release"
68 "-DWITH_XC_UPDATECHECK=OFF"
70 ++ (lib.optional (!withKeePassX11) "-DWITH_XC_X11=OFF")
71 ++ (lib.optional (withKeePassFDOSecrets && stdenv.isLinux) "-DWITH_XC_FDOSECRETS=ON")
72 ++ (lib.optional (withKeePassYubiKey && stdenv.isLinux) "-DWITH_XC_YUBIKEY=ON")
73 ++ (lib.optional withKeePassBrowser "-DWITH_XC_BROWSER=ON")
74 ++ (lib.optional withKeePassBrowserPasskeys "-DWITH_XC_BROWSER_PASSKEYS=ON")
75 ++ (lib.optional withKeePassKeeShare "-DWITH_XC_KEESHARE=ON")
76 ++ (lib.optional withKeePassNetworking "-DWITH_XC_NETWORKING=ON")
77 ++ (lib.optional withKeePassSSHAgent "-DWITH_XC_SSHAGENT=ON");
83 export LC_ALL="en_US.UTF-8"
84 export QT_QPA_PLATFORM=offscreen
85 export QT_PLUGIN_PATH="${qtbase.bin}/${qtbase.qtPluginPrefix}"
86 # testcli, testgui and testkdbx4 are flaky - skip them all
87 # testautotype on darwin throws "QWidget: Cannot create a QWidget without QApplication"
88 make test ARGS+="-E 'testcli|testgui${lib.optionalString stdenv.isDarwin "|testautotype|testkdbx4"}' --output-on-failure"
100 ++ lib.optional (!stdenv.isDarwin) wrapGAppsHook;
102 dontWrapGApps = true;
104 qtWrapperArgs+=("''${gappsWrapperArgs[@]}")
105 '' + lib.optionalString stdenv.isDarwin ''
106 wrapQtApp "$out/Applications/KeePassXC.app/Contents/MacOS/KeePassXC"
109 # See https://github.com/keepassxreboot/keepassxc/blob/cd7a53abbbb81e468efb33eb56eefc12739969b8/src/browser/NativeMessageInstaller.cpp#L317
110 postInstall = lib.optionalString withKeePassBrowser ''
111 mkdir -p "$out/lib/mozilla/native-messaging-hosts"
112 substituteAll "${./firefox-native-messaging-host.json}" "$out/lib/mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json"
129 ++ lib.optional (stdenv.isDarwin && withKeePassTouchID) LocalAuthentication
130 ++ lib.optional stdenv.isDarwin qtmacextras
131 ++ lib.optional stdenv.isLinux libusb1
132 ++ lib.optional withKeePassX11 qtx11extras;
134 passthru.tests = nixosTests.keepassxc;
137 description = "Offline password manager with many features.";
139 A community fork of KeePassX, which is itself a port of KeePass Password Safe.
140 The goal is to extend and improve KeePassX with new features and bugfixes,
141 to provide a feature-rich, fully cross-platform and modern open-source password manager.
142 Accessible via native cross-platform GUI, CLI, has browser integration
143 using the KeePassXC Browser Extension (https://github.com/keepassxreboot/keepassxc-browser)
145 homepage = "https://keepassxc.org/";
146 license = licenses.gpl2Plus;
147 maintainers = with maintainers; [ jonafato blankparticle ];
148 platforms = platforms.linux ++ platforms.darwin;