1{
2 fetchFromGitHub,
3 lib,
4 stdenv,
5 git,
6 gnupg,
7 pass,
8 pwgen,
9 qrencode,
10 qtbase,
11 qtsvg,
12 qttools,
13 qmake,
14 wrapQtAppsHook,
15 makeWrapper,
16}:
17
18stdenv.mkDerivation rec {
19 pname = "qtpass";
20 version = "1.4.0";
21
22 src = fetchFromGitHub {
23 owner = "IJHack";
24 repo = "QtPass";
25 rev = "v${version}";
26 sha256 = "sha256-oKLLmsuXD2Hb2LQ4tcJP2gpR6eLaM/JzDhRcRSpUPYI=";
27 };
28
29 postPatch = ''
30 substituteInPlace src/qtpass.cpp \
31 --replace "/usr/bin/qrencode" "${qrencode}/bin/qrencode"
32 '';
33
34 buildInputs = [
35 git
36 gnupg
37 pass
38 qtbase
39 qtsvg
40 ];
41
42 nativeBuildInputs = [
43 qmake
44 qttools
45 wrapQtAppsHook
46 makeWrapper
47 ];
48
49 qmakeFlags = [
50 # setup hook only sets QMAKE_LRELEASE, set QMAKE_LUPDATE too:
51 "QMAKE_LUPDATE=${qttools.dev}/bin/lupdate"
52 ];
53
54 qtWrapperArgs = [
55 "--suffix PATH : ${
56 lib.makeBinPath [
57 git
58 gnupg
59 pass
60 pwgen
61 ]
62 }"
63 ];
64
65 installPhase = lib.optionalString stdenv.hostPlatform.isDarwin ''
66 runHook preInstall
67 mkdir -p $out/Applications
68 cp -r main/QtPass.app $out/Applications
69 makeWrapper $out/Applications/QtPass.app/Contents/MacOS/QtPass $out/bin/qtpass
70 runHook postInstall
71 '';
72
73 postInstall = ''
74 install -D qtpass.desktop -t $out/share/applications
75 install -D artwork/icon.svg $out/share/icons/hicolor/scalable/apps/qtpass-icon.svg
76 install -D qtpass.1 -t $out/share/man/man1
77 '';
78
79 meta = with lib; {
80 description = "Multi-platform GUI for pass, the standard unix password manager";
81 mainProgram = "qtpass";
82 homepage = "https://qtpass.org";
83 license = licenses.gpl3;
84 maintainers = [ maintainers.hrdinka ];
85 platforms = platforms.all;
86 };
87}