|
| 1 | +{ |
| 2 | + lib, |
| 3 | + stdenv, |
| 4 | + fetchFromCodeberg, |
| 5 | + |
| 6 | + asciidoctor, |
| 7 | + botan3, |
| 8 | + cmake, |
| 9 | + libargon2, |
| 10 | + libusb1, |
| 11 | + libxtst, |
| 12 | + minizip, |
| 13 | + nix-update-script, |
| 14 | + pcsclite, |
| 15 | + pkg-config, |
| 16 | + qrencode, |
| 17 | + qt6Packages, |
| 18 | + readline, |
| 19 | + wrapGAppsHook3, |
| 20 | + zlib, |
| 21 | + zxcvbn-c, |
| 22 | + |
| 23 | + withChiPassBrowser ? true, |
| 24 | + withChiPassBrowserPasskeys ? true, |
| 25 | + withChiPassFDOSecrets ? true, |
| 26 | + withChiPassKeeShare ? true, |
| 27 | + withChiPassNetworking ? true, |
| 28 | + withChiPassSSHAgent ? true, |
| 29 | + withChiPassX11 ? true, |
| 30 | + withChiPassYubiKey ? true, |
| 31 | + |
| 32 | + nixosTests, |
| 33 | +}: |
| 34 | + |
| 35 | +stdenv.mkDerivation (finalAttrs: { |
| 36 | + pname = "chipass"; |
| 37 | + version = "2026.09.0"; |
| 38 | + |
| 39 | + src = fetchFromCodeberg { |
| 40 | + owner = "ChiPass"; |
| 41 | + repo = "ChiPass"; |
| 42 | + tag = "v${finalAttrs.version}"; |
| 43 | + hash = "sha256-6nA7NziEgiQolhx5cGdyZZTJ5JcKWz9WQOiJ3JiZ6UQ="; |
| 44 | + }; |
| 45 | + |
| 46 | + env = lib.optionalAttrs stdenv.cc.isClang { |
| 47 | + NIX_CFLAGS_COMPILE = toString [ |
| 48 | + "-Wno-old-style-cast" |
| 49 | + "-Wno-error" |
| 50 | + "-D__BIG_ENDIAN__=${if stdenv.hostPlatform.isBigEndian then "1" else "0"}" |
| 51 | + ]; |
| 52 | + }; |
| 53 | + |
| 54 | + # Upstream develops against a build of PCSC from Xcode. |
| 55 | + # The types are incompatible with nixpkgs pcsclite. |
| 56 | + # https://github.com/NixOS/nixpkgs/issues/520227 |
| 57 | + postPatch = '' |
| 58 | + substituteInPlace src/keys/drivers/YubiKeyInterfacePCSC.cpp \ |
| 59 | + --replace-fail "typedef uint32_t RETVAL;" "typedef int32_t RETVAL;" |
| 60 | + ''; |
| 61 | + |
| 62 | + cmakeFlags = [ |
| 63 | + (lib.cmakeFeature "CHIPASS_BUILD_TYPE" "Release") |
| 64 | + (lib.cmakeBool "CHIPASS_WITH_GUI_TESTS" true) |
| 65 | + (lib.cmakeBool "CHIPASS_WITH_UPDATE_CHECK" false) |
| 66 | + (lib.cmakeOptionType "list" "CHIPASS_DESKTOP_TYPES" ( |
| 67 | + lib.concatStringsSep ";" ([ "Wayland" ] ++ lib.optional withChiPassX11 "X11") |
| 68 | + )) |
| 69 | + (lib.cmakeBool "CHIPASS_WITH_BROWSER" withChiPassBrowser) |
| 70 | + (lib.cmakeBool "CHIPASS_WITH_BROWSER_PASSKEYS" withChiPassBrowserPasskeys) |
| 71 | + (lib.cmakeBool "CHIPASS_WITH_KEESHARE" withChiPassKeeShare) |
| 72 | + (lib.cmakeBool "CHIPASS_WITH_NETWORKING" withChiPassNetworking) |
| 73 | + (lib.cmakeBool "CHIPASS_WITH_SSHAGENT" withChiPassSSHAgent) |
| 74 | + (lib.cmakeBool "CHIPASS_WITH_FDOSECRETS" withChiPassFDOSecrets) |
| 75 | + (lib.cmakeBool "CHIPASS_WITH_YUBIKEY" withChiPassYubiKey) |
| 76 | + ]; |
| 77 | + |
| 78 | + doCheck = true; |
| 79 | + checkPhase = |
| 80 | + let |
| 81 | + disabledTests = lib.concatStringsSep "|" [ |
| 82 | + # flaky |
| 83 | + "cli" |
| 84 | + "gui" |
| 85 | + "guipixmaps" |
| 86 | + "guibrowser" |
| 87 | + "guifdosecrets" |
| 88 | + ]; |
| 89 | + in |
| 90 | + '' |
| 91 | + runHook preCheck |
| 92 | +
|
| 93 | + export LC_ALL="en_US.UTF-8" |
| 94 | + export QT_QPA_PLATFORM=offscreen |
| 95 | + export QT_PLUGIN_PATH="${qt6Packages.qtbase}/bin/${qt6Packages.qtbase.qtPluginPrefix}" |
| 96 | +
|
| 97 | + make test ARGS+="-E '${disabledTests}' --output-on-failure" |
| 98 | +
|
| 99 | + runHook postCheck |
| 100 | + ''; |
| 101 | + |
| 102 | + nativeBuildInputs = [ |
| 103 | + asciidoctor |
| 104 | + cmake |
| 105 | + pkg-config |
| 106 | + qt6Packages.qttools |
| 107 | + qt6Packages.wrapQtAppsHook |
| 108 | + wrapGAppsHook3 |
| 109 | + ]; |
| 110 | + |
| 111 | + dontWrapGApps = true; |
| 112 | + preFixup = '' |
| 113 | + qtWrapperArgs+=("''${gappsWrapperArgs[@]}") |
| 114 | + ''; |
| 115 | + |
| 116 | + postInstall = ( |
| 117 | + # See https://github.com/keepassxreboot/keepassxc/blob/cd7a53abbbb81e468efb33eb56eefc12739969b8/src/browser/NativeMessageInstaller.cpp#L317 |
| 118 | + # See https://github.com/keepassxreboot/keepassxc/blob/cd7a53abbbb81e468efb33eb56eefc12739969b8/utils/keepassxc-snap-helper.sh#L48-L58 |
| 119 | + lib.optionalString withChiPassBrowser '' |
| 120 | + mkdir -p "$out/lib/mozilla/native-messaging-hosts" |
| 121 | + substituteAll "${./firefox-native-messaging-host.json}" "$out/lib/mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json" |
| 122 | +
|
| 123 | + mkdir -p "$out/etc/chromium/native-messaging-hosts" |
| 124 | + substituteAll "${./chromium-native-messaging-host.json}" "$out/etc/chromium/native-messaging-hosts/org.keepassxc.keepassxc_browser.json" |
| 125 | + '' |
| 126 | + ); |
| 127 | + |
| 128 | + buildInputs = [ |
| 129 | + botan3 |
| 130 | + libargon2 |
| 131 | + libusb1 |
| 132 | + libxtst |
| 133 | + minizip |
| 134 | + pcsclite |
| 135 | + qrencode |
| 136 | + qt6Packages.appstream-qt |
| 137 | + qt6Packages.qt5compat |
| 138 | + qt6Packages.qtbase |
| 139 | + qt6Packages.qtsvg |
| 140 | + readline |
| 141 | + zlib |
| 142 | + zxcvbn-c |
| 143 | + ]; |
| 144 | + |
| 145 | + passthru = { |
| 146 | + tests = { |
| 147 | + inherit (nixosTests) chipass; |
| 148 | + }; |
| 149 | + updateScript = nix-update-script { }; |
| 150 | + }; |
| 151 | + |
| 152 | + meta = { |
| 153 | + description = "A cross-platform password manager for people with extremely high demands on secure personal data management"; |
| 154 | + longDescription = '' |
| 155 | + ChiPass is a modern, secure, and open-source password manager that stores and manages your most sensitive information. You can run ChiPass on Windows, macOS, and Linux systems. ChiPass is for people with extremely high demands of secure personal data management. It saves many different types of information, such as usernames, passwords, URLs, attachments, and notes in an offline, encrypted file that can be stored in any location, including private and public cloud solutions. For easy identification and management, user-defined titles and icons can be specified for entries. In addition, entries are sorted into customizable groups. An integrated search function allows you to use advanced patterns to easily find any entry in your database. A customizable, fast, and easy-to-use password generator utility allows you to create passwords with any combination of characters or easy to remember passphrases. |
| 156 | + ''; |
| 157 | + homepage = "https://chipass.org"; |
| 158 | + changelog = "https://codeberg.org/ChiPass/ChiPass/src/tag/v${finalAttrs.version}/CHANGELOG.md"; |
| 159 | + license = lib.licenses.gpl2Plus; |
| 160 | + mainProgram = "chipass"; |
| 161 | + maintainers = with lib.maintainers; [ |
| 162 | + provokateurin |
| 163 | + ]; |
| 164 | + platforms = lib.platforms.linux; |
| 165 | + }; |
| 166 | +}) |
0 commit comments