1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, pkg-config
6, zip
7, gettext
8, perl
9, wxGTK32
10, libXext
11, libXi
12, libXt
13, libXtst
14, xercesc
15, qrencode
16, libuuid
17, libyubikey
18, yubikey-personalization
19, curl
20, openssl
21, file
22, darwin
23, gitUpdater
24}:
25
26let
27 inherit (darwin.apple_sdk.frameworks) Cocoa;
28in
29stdenv.mkDerivation rec {
30 pname = "pwsafe";
31 version = "1.16.0"; # do NOT update to 3.x Windows releases
32
33 src = fetchFromGitHub {
34 owner = pname;
35 repo = pname;
36 rev = version;
37 hash = "sha256-5/TOg+hiy22vlPJHheE638abhS3B5Jrul0Umgwu+gi0=";
38 };
39
40 strictDeps = true;
41
42 nativeBuildInputs = [
43 cmake
44 gettext
45 perl
46 pkg-config
47 zip
48 ];
49
50 buildInputs = [
51 wxGTK32
52 curl
53 qrencode
54 openssl
55 xercesc
56 file
57 ] ++ lib.optionals stdenv.isLinux [
58 libXext
59 libXi
60 libXt
61 libXtst
62 libuuid
63 libyubikey
64 yubikey-personalization
65 ] ++ lib.optionals stdenv.isDarwin [
66 Cocoa
67 ];
68
69 cmakeFlags = [
70 "-DNO_GTEST=ON"
71 "-DCMAKE_CXX_FLAGS=-I${yubikey-personalization}/include/ykpers-1"
72 ] ++ lib.optionals stdenv.isDarwin [
73 "-DNO_YUBI=ON"
74 ];
75
76 postPatch = ''
77 # Fix perl scripts used during the build.
78 for f in $(find . -type f -name '*.pl') ; do
79 patchShebangs $f
80 done
81
82 # Fix hard coded paths.
83 for f in $(grep -Rl /usr/share/ src install/desktop) ; do
84 substituteInPlace $f --replace /usr/share/ $out/share/
85 done
86
87 # Fix hard coded zip path.
88 substituteInPlace help/Makefile.linux --replace /usr/bin/zip ${zip}/bin/zip
89
90 for f in $(grep -Rl /usr/bin/ .) ; do
91 substituteInPlace $f --replace /usr/bin/ ""
92 done
93 '' + lib.optionalString stdenv.isDarwin ''
94 substituteInPlace src/ui/cli/CMakeLists.txt --replace "uuid" ""
95 '';
96
97 installFlags = [ "PREFIX=${placeholder "out"}" ];
98
99 passthru.updateScript = gitUpdater {
100 ignoredVersions = "^([^1]|1[^.])"; # ignore anything other than 1.x
101 url = src.gitRepoUrl;
102 };
103
104 meta = with lib; {
105 description = "A password database utility";
106 longDescription = ''
107 Password Safe is a password database utility. Like many other
108 such products, commercial and otherwise, it stores your
109 passwords in an encrypted file, allowing you to remember only
110 one password (the "safe combination"), instead of all the
111 username/password combinations that you use.
112 '';
113 homepage = "https://pwsafe.org/";
114 maintainers = with maintainers; [ c0bw3b pjones ];
115 platforms = platforms.unix;
116 license = licenses.artistic2;
117 };
118}