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