summaryrefslogtreecommitdiff
path: root/overlays/keepassxc
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2026-09-27 12:37:52 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2026-09-27 12:37:52 +0200
commitbadf7aba844967c5d13e01079c12df758715167a (patch)
tree3c0872b667a64a82caf7bab3d2503c9f7a6444b9 /overlays/keepassxc
parent74d97f767ac4d6f05ce95e388460a49c5190afc3 (diff)
downloadnixos-flakes.tar
nixos-flakes.tar.gz
nixos-flakes.tar.bz2
nixos-flakes.tar.xz
nixos-flakes.zip
Diffstat (limited to 'overlays/keepassxc')
-rw-r--r--overlays/keepassxc/default.nix111
1 files changed, 107 insertions, 4 deletions
diff --git a/overlays/keepassxc/default.nix b/overlays/keepassxc/default.nix
index 46b3a459..f8d6cb07 100644
--- a/overlays/keepassxc/default.nix
+++ b/overlays/keepassxc/default.nix
@@ -1,8 +1,111 @@
1{ final, prev, ... }: 1{ final, prev, flakeInputs, ... }:
2{ 2{
3 keepassxc = prev.keepassxc.overrideAttrs (oldAttrs: { 3 keepassxc = final.stdenv.mkDerivation (finalAttrs: {
4 patches = (oldAttrs.patches or []) ++ prev.lib.optional (prev.lib.versionAtLeast oldAttrs.version "2.7.9") [ 4 pname = "keepassxc";
5 ./database-open-dialog.patch 5 version = "2.8.0-beta1";
6
7 src = final.fetchFromGitHub {
8 owner = "keepassxreboot";
9 repo = "keepassxc";
10 tag = finalAttrs.version;
11 hash = "sha256-fksThYmGZed66zxGDxlS2SHQzJYRf+T9AuZPbaNZV5Y=";
12 };
13
14 env =
15 final.lib.optionalAttrs final.stdenv.cc.isClang {
16 NIX_CFLAGS_COMPILE = toString [
17 "-Wno-old-style-cast"
18 "-Wno-error"
19 "-D__BIG_ENDIAN__=${if final.stdenv.hostPlatform.isBigEndian then "1" else "0"}"
20 ];
21 };
22
23 # Upstream develops against a build of PCSC from Xcode.
24 # The types are incompatible with nixpkgs pcsclite.
25 # https://github.com/NixOS/nixpkgs/issues/520227
26 postPatch = ''
27 substituteInPlace src/keys/drivers/YubiKeyInterfacePCSC.cpp \
28 --replace-fail "typedef uint32_t RETVAL;" "typedef int32_t RETVAL;"
29 '';
30
31 cmakeFlags = [
32 (final.lib.cmakeFeature "KEEPASSXC_BUILD_TYPE" "Release")
33 (final.lib.cmakeBool "WITH_GUI_TESTS" true)
34 (final.lib.cmakeBool "WITH_XC_UPDATECHECK" false)
35 (final.lib.cmakeBool "WITH_XC_X11" false)
36 (final.lib.cmakeBool "WITH_XC_BROWSER" true)
37 (final.lib.cmakeBool "WITH_XC_BROWSER_PASSKEYS" true)
38 (final.lib.cmakeBool "WITH_XC_KEESHARE" true)
39 (final.lib.cmakeBool "WITH_XC_NETWORKING" true)
40 (final.lib.cmakeBool "WITH_XC_SSHAGENT" true)
41 (final.lib.cmakeBool "WITH_XC_FDOSECRETS" true)
42 (final.lib.cmakeBool "WITH_XC_YUBIKEY" true)
43 ];
44
45 doCheck = true;
46 checkPhase =
47 let
48 disabledTests = final.lib.concatStringsSep "|" (
49 [
50 # flaky
51 "testcli"
52 "testgui"
53 ]
54 );
55 in
56 ''
57 runHook preCheck
58
59 export LC_ALL="en_US.UTF-8"
60 export QT_QPA_PLATFORM=offscreen
61 export QT_PLUGIN_PATH="${final.qt6.qtbase}/${final.qt6.qtbase.qtPluginPrefix}"
62
63 make test ARGS+="-E '${disabledTests}' --output-on-failure"
64
65 runHook postCheck
66 '';
67
68 nativeBuildInputs = with final; [
69 asciidoctor
70 cmake
71 qt6.wrapQtAppsHook
72 qt6.qttools
73 pkg-config
74 wrapGAppsHook3
75 ];
76
77 dontWrapGApps = true;
78 preFixup = ''
79 qtWrapperArgs+=("''${gappsWrapperArgs[@]}")
80 '';
81
82 postInstall = final.lib.concatLines [
83 # See https://github.com/keepassxreboot/keepassxc/blob/cd7a53abbbb81e468efb33eb56eefc12739969b8/src/browser/NativeMessageInstaller.cpp#L317
84 # See https://github.com/keepassxreboot/keepassxc/blob/cd7a53abbbb81e468efb33eb56eefc12739969b8/utils/keepassxc-snap-helper.sh#L48-L58
85 ''
86 mkdir -p "$out/lib/mozilla/native-messaging-hosts"
87 substituteAll "${toString (flakeInputs.nixpkgs) + "/pkgs/by-name/ke/keepassxc/firefox-native-messaging-host.json"}" "$out/lib/mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json"
88
89 mkdir -p "$out/etc/chromium/native-messaging-hosts"
90 substituteAll "${toString (flakeInputs.nixpkgs) + "/pkgs/by-name/ke/keepassxc/chromium-native-messaging-host.json"}" "$out/etc/chromium/native-messaging-hosts/org.keepassxc.keepassxc_browser.json"
91 ''
92 ];
93
94 buildInputs = with final; [
95 botan3
96 curl
97 libxi
98 libxtst
99 libargon2
100 qt6.qtbase
101 qt6.qtsvg
102 minizip
103 pcsclite
104 qrencode
105 readline
106 zlib
107 libusb1
108 keyutils
6 ]; 109 ];
7 }); 110 });
8} 111}