1{ lib, buildGoModule, fetchFromGitHub, makeWrapper, gnupg }:
2buildGoModule rec {
3 pname = "browserpass";
4 version = "3.0.10";
5
6 src = fetchFromGitHub {
7 owner = "browserpass";
8 repo = "browserpass-native";
9 rev = version;
10 sha256 = "8eAwUwcRTnhVDkQc3HsvTP0TqC4LfVrUelxdbJxe9t0=";
11 };
12
13 nativeBuildInputs = [ makeWrapper ];
14
15 vendorSha256 = "gWXcYyIp86b/Pn6vj7qBj/VZS9rTr4weVw0YWmg+36c=";
16
17 doCheck = false;
18
19 postPatch = ''
20 # Because this Makefile will be installed to be used by the user, patch
21 # variables to be valid by default
22 substituteInPlace Makefile \
23 --replace "PREFIX ?= /usr" ""
24 sed -i -e 's/SED =.*/SED = sed/' Makefile
25 sed -i -e 's/INSTALL =.*/INSTALL = install/' Makefile
26 '';
27
28 DESTDIR = placeholder "out";
29
30 postConfigure = ''
31 make configure
32 '';
33
34 buildPhase = ''
35 make
36 '';
37
38 installPhase = ''
39 make install
40
41 wrapProgram $out/bin/browserpass \
42 --suffix PATH : ${lib.makeBinPath [ gnupg ]}
43
44 # This path is used by our firefox wrapper for finding native messaging hosts
45 mkdir -p $out/lib/mozilla/native-messaging-hosts
46 ln -s $out/lib/browserpass/hosts/firefox/*.json $out/lib/mozilla/native-messaging-hosts
47 '';
48
49 meta = with lib; {
50 description = "Browserpass native client app";
51 homepage = "https://github.com/browserpass/browserpass-native";
52 license = licenses.isc;
53 maintainers = with maintainers; [ rvolosatovs infinisil ];
54 };
55}